Skip to content

Commit 11b9bc5

Browse files
authored
Remove some more py27-isms (#1062)
1 parent 853fefa commit 11b9bc5

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

doc/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def find_version(*file_paths):
7272
master_doc = "index"
7373

7474
# General information about the project.
75-
project = u"pyOpenSSL"
76-
authors = u"The pyOpenSSL developers"
77-
copyright = u"2001 " + authors
75+
project = "pyOpenSSL"
76+
authors = "The pyOpenSSL developers"
77+
copyright = "2001 " + authors
7878

7979
# The version info for the project you're documenting, acts as replacement for
8080
# |version| and |release|, also used in various other places throughout the
@@ -217,7 +217,7 @@ def find_version(*file_paths):
217217
# Grouping the document tree into LaTeX files. List of tuples
218218
# (source start file, target name, title, author, documentclass [howto/manual])
219219
latex_documents = [
220-
("index", "pyOpenSSL.tex", u"pyOpenSSL Documentation", authors, "manual"),
220+
("index", "pyOpenSSL.tex", "pyOpenSSL Documentation", authors, "manual"),
221221
]
222222

223223
# The name of an image file (relative to this directory) to place at the top of
@@ -248,7 +248,7 @@ def find_version(*file_paths):
248248

249249
# One entry per manual page. List of tuples
250250
# (source start file, name, description, authors, manual section).
251-
man_pages = [("index", "pyopenssl", u"pyOpenSSL Documentation", [authors], 1)]
251+
man_pages = [("index", "pyopenssl", "pyOpenSSL Documentation", [authors], 1)]
252252

253253
intersphinx_mapping = {
254254
"https://docs.python.org/3": None,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[tool.black]
22
line-length = 79
3-
target-version = ["py27"]
3+
target-version = ["py36"]
44

src/OpenSSL/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from . import version
1111

1212

13-
_env_info = u"""\
13+
_env_info = """\
1414
pyOpenSSL: {pyopenssl}
1515
cryptography: {cryptography}
1616
cffi: {cffi}

tests/test_crypto.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,7 +2467,7 @@ def check_recovery(
24672467
b"-nodes",
24682468
b"-passin",
24692469
b"pass:" + passwd,
2470-
*extra
2470+
*extra,
24712471
)
24722472
assert recovered_key[-len(key) :] == key
24732473
if cert:
@@ -2479,7 +2479,7 @@ def check_recovery(
24792479
b"-passin",
24802480
b"pass:" + passwd,
24812481
b"-nokeys",
2482-
*extra
2482+
*extra,
24832483
)
24842484
assert recovered_cert[-len(cert) :] == cert
24852485
if ca:
@@ -2491,7 +2491,7 @@ def check_recovery(
24912491
b"-passin",
24922492
b"pass:" + passwd,
24932493
b"-nokeys",
2494-
*extra
2494+
*extra,
24952495
)
24962496
assert recovered_cert[-len(ca) :] == ca
24972497

@@ -3477,7 +3477,7 @@ def test_reason(self):
34773477
revoked.set_reason(None)
34783478
assert revoked.get_reason() is None
34793479

3480-
@pytest.mark.parametrize("reason", [object(), 1.0, u"foo"])
3480+
@pytest.mark.parametrize("reason", [object(), 1.0, "foo"])
34813481
def test_set_reason_wrong_args(self, reason):
34823482
"""
34833483
`Revoked.set_reason` raises `TypeError` if called with an argument
@@ -3553,12 +3553,12 @@ def test_export_pem(self):
35533553
assert revoked is not None
35543554
assert crl.issuer == x509.Name(
35553555
[
3556-
x509.NameAttribute(x509.NameOID.COUNTRY_NAME, u"US"),
3557-
x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, u"IL"),
3558-
x509.NameAttribute(x509.NameOID.LOCALITY_NAME, u"Chicago"),
3559-
x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, u"Testing"),
3556+
x509.NameAttribute(x509.NameOID.COUNTRY_NAME, "US"),
3557+
x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, "IL"),
3558+
x509.NameAttribute(x509.NameOID.LOCALITY_NAME, "Chicago"),
3559+
x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, "Testing"),
35603560
x509.NameAttribute(
3561-
x509.NameOID.COMMON_NAME, u"Testing Root CA"
3561+
x509.NameOID.COMMON_NAME, "Testing Root CA"
35623562
),
35633563
]
35643564
)
@@ -3580,12 +3580,12 @@ def test_export_der(self):
35803580
assert revoked is not None
35813581
assert crl.issuer == x509.Name(
35823582
[
3583-
x509.NameAttribute(x509.NameOID.COUNTRY_NAME, u"US"),
3584-
x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, u"IL"),
3585-
x509.NameAttribute(x509.NameOID.LOCALITY_NAME, u"Chicago"),
3586-
x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, u"Testing"),
3583+
x509.NameAttribute(x509.NameOID.COUNTRY_NAME, "US"),
3584+
x509.NameAttribute(x509.NameOID.STATE_OR_PROVINCE_NAME, "IL"),
3585+
x509.NameAttribute(x509.NameOID.LOCALITY_NAME, "Chicago"),
3586+
x509.NameAttribute(x509.NameOID.ORGANIZATION_NAME, "Testing"),
35873587
x509.NameAttribute(
3588-
x509.NameOID.COMMON_NAME, u"Testing Root CA"
3588+
x509.NameOID.COMMON_NAME, "Testing Root CA"
35893589
),
35903590
]
35913591
)
@@ -4375,7 +4375,7 @@ def test_not_a_curve(self):
43754375
does not identify a supported curve.
43764376
"""
43774377
with pytest.raises(ValueError):
4378-
get_elliptic_curve(u"this curve was just invented")
4378+
get_elliptic_curve("this curve was just invented")
43794379

43804380
def test_repr(self):
43814381
"""

tests/test_ssl.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ def ca_file(tmpdir):
454454

455455
builder = x509.CertificateBuilder()
456456
builder = builder.subject_name(
457-
x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u"pyopenssl.org")])
457+
x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "pyopenssl.org")])
458458
)
459459
builder = builder.issuer_name(
460-
x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, u"pyopenssl.org")])
460+
x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, "pyopenssl.org")])
461461
)
462462
one_day = datetime.timedelta(1, 0, 0)
463463
builder = builder.not_valid_before(datetime.datetime.today() - one_day)
@@ -498,7 +498,7 @@ class TestContext(object):
498498

499499
@pytest.mark.parametrize(
500500
"cipher_string",
501-
[b"hello world:AES128-SHA", u"hello world:AES128-SHA"],
501+
[b"hello world:AES128-SHA", "hello world:AES128-SHA"],
502502
)
503503
def test_set_cipher_list(self, context, cipher_string):
504504
"""
@@ -588,7 +588,7 @@ def test_set_session_id_unicode(self, context):
588588
`Context.set_session_id` raises a warning if a unicode string is
589589
passed.
590590
"""
591-
pytest.deprecated_call(context.set_session_id, u"abc")
591+
pytest.deprecated_call(context.set_session_id, "abc")
592592

593593
def test_method(self):
594594
"""
@@ -1708,7 +1708,7 @@ def test_set_tmp_ecdh(self):
17081708
"""
17091709
context = Context(SSLv23_METHOD)
17101710
for curve in get_elliptic_curves():
1711-
if curve.name.startswith(u"Oakley-"):
1711+
if curve.name.startswith("Oakley-"):
17121712
# Setting Oakley-EC2N-4 and Oakley-EC2N-3 adds
17131713
# ('bignum routines', 'BN_mod_inverse', 'no inverse') to the
17141714
# error queue on OpenSSL 1.0.2.
@@ -2068,7 +2068,7 @@ def test_alpn_select_cb_returns_invalid_value(self):
20682068

20692069
def invalid_cb(conn, options):
20702070
invalid_cb_args.append((conn, options))
2071-
return u"can't return unicode"
2071+
return "can't return unicode"
20722072

20732073
client_context = Context(SSLv23_METHOD)
20742074
client_context.set_alpn_protos([b"http/1.1", b"spdy/2"])
@@ -2235,7 +2235,7 @@ def test_bio_write(self):
22352235
connection.bio_write(b"xy")
22362236
connection.bio_write(bytearray(b"za"))
22372237
with pytest.warns(DeprecationWarning):
2238-
connection.bio_write(u"deprecated")
2238+
connection.bio_write("deprecated")
22392239

22402240
def test_get_context(self):
22412241
"""

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = {pypy,pypy3,py27,py36,py37,py38,py39,py310}{,-cryptographyMain,-cryptographyMinimum}{,-useWheel}{,-randomorder},py37-twistedTrunk,pypi-readme,check-manifest,flake8,docs,coverage-report
2+
envlist = {pypy,pypy3,py36,py37,py38,py39,py310}{,-cryptographyMain,-cryptographyMinimum}{,-useWheel}{,-randomorder},py37-twistedTrunk,pypi-readme,check-manifest,flake8,docs,coverage-report
33

44
[testenv]
55
whitelist_externals =

0 commit comments

Comments
 (0)