Skip to content

Commit a849f40

Browse files
atombrellareaperhulk
authored andcommitted
Use literals for collections and comprehensions. (pyca#5091)
1 parent 1d6ef10 commit a849f40

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

docs/development/custom-vectors/hkdf/generate_hkdf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020

2121
def _build_vectors():
22-
output = []
23-
output.append("COUNT = 0")
24-
output.append("Hash = SHA-256")
25-
output.append("IKM = " + binascii.hexlify(IKM).decode("ascii"))
26-
output.append("salt = ")
27-
output.append("info = ")
28-
output.append("L = {}".format(L))
29-
output.append("OKM = " + binascii.hexlify(OKM).decode("ascii"))
22+
output = [
23+
"COUNT = 0",
24+
"Hash = SHA-256",
25+
"IKM = " + binascii.hexlify(IKM).decode("ascii"),
26+
"salt = ", "info = ",
27+
"L = {}".format(L),
28+
"OKM = " + binascii.hexlify(OKM).decode("ascii"),
29+
]
3030
return "\n".join(output)
3131

3232

src/cryptography/hazmat/backends/openssl/decode_asn1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _decode_x509_name(backend, x509_name):
6464
attribute = _decode_x509_name_entry(backend, entry)
6565
set_id = backend._lib.Cryptography_X509_NAME_ENTRY_set(entry)
6666
if set_id != prev_set_id:
67-
attributes.append(set([attribute]))
67+
attributes.append({attribute})
6868
else:
6969
# is in the same RDN a previous entry
7070
attributes[-1].add(attribute)

src/cryptography/x509/name.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _ASN1Type(Enum):
2525
BMPString = 30
2626

2727

28-
_ASN1_TYPE_TO_ENUM = dict((i.value, i) for i in _ASN1Type)
28+
_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type}
2929
_SENTINEL = object()
3030
_NAMEOID_DEFAULT_TYPE = {
3131
NameOID.COUNTRY_NAME: _ASN1Type.PrintableString,

src/cryptography/x509/ocsp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class OCSPResponseStatus(Enum):
4141
UNAUTHORIZED = 6
4242

4343

44-
_RESPONSE_STATUS_TO_ENUM = dict((x.value, x) for x in OCSPResponseStatus)
44+
_RESPONSE_STATUS_TO_ENUM = {x.value: x for x in OCSPResponseStatus}
4545
_ALLOWED_HASHES = (
4646
hashes.SHA1, hashes.SHA224, hashes.SHA256,
4747
hashes.SHA384, hashes.SHA512
@@ -61,7 +61,7 @@ class OCSPCertStatus(Enum):
6161
UNKNOWN = 2
6262

6363

64-
_CERT_STATUS_TO_ENUM = dict((x.value, x) for x in OCSPCertStatus)
64+
_CERT_STATUS_TO_ENUM = {x.value: x for x in OCSPCertStatus}
6565

6666

6767
def load_der_ocsp_request(data):

0 commit comments

Comments
 (0)