Skip to content

Commit

Permalink
Apply refurb suggestion
Browse files Browse the repository at this point in the history
[FURB108]: Replace `x == y or x == z` with `x in (y, z)`
  • Loading branch information
DimitriPapadopoulos committed Nov 30, 2023
1 parent 38e04cc commit 05689e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cryptography/hazmat/backends/openssl/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def openssl_version_number(self) -> int:
return self._lib.OpenSSL_version_num()

def _evp_md_from_algorithm(self, algorithm: hashes.HashAlgorithm):
if algorithm.name == "blake2b" or algorithm.name == "blake2s":
if algorithm.name in ("blake2b", "blake2s"):
alg = f"{algorithm.name}{algorithm.digest_size * 8}".encode(
"ascii"
)
Expand Down
5 changes: 1 addition & 4 deletions src/cryptography/x509/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ def __init__(
if not isinstance(value, str):
raise TypeError("value argument must be a str")

if (
oid == NameOID.COUNTRY_NAME
or oid == NameOID.JURISDICTION_COUNTRY_NAME
):
if (oid in (NameOID.COUNTRY_NAME, NameOID.JURISDICTION_COUNTRY_NAME)):
assert isinstance(value, str)
c_len = len(value.encode("utf8"))
if c_len != 2 and _validate is True:
Expand Down

0 comments on commit 05689e8

Please sign in to comment.