Skip to content

Commit

Permalink
Update for new flake8 checks (#423)
Browse files Browse the repository at this point in the history
Update python code for new flake8 type is checks
  • Loading branch information
emlowe committed Aug 7, 2023
2 parents 900af6a + 4ff2ed2 commit a2a912a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python-impl/ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, x, y, infinity: bool, ec=default_ec):
if (
(not isinstance(x, Fq) and not isinstance(x, FieldExtBase))
or (not isinstance(y, Fq) and not isinstance(y, FieldExtBase))
or type(x) != type(y)
or type(x) is not type(y)
):
raise Exception("x,y should be field elements")
self.FE = type(x)
Expand Down
8 changes: 4 additions & 4 deletions python-impl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@


def hash256(m):
if type(m) != bytes:
if type(m) is not bytes:
m = m.encode("utf-8")
return hashlib.sha256(m).digest()


def hash512(m):
if type(m) != bytes:
if type(m) is not bytes:
m = m.encode("utf-8")
return hash256(m + bytes([0])) + hash256(m + bytes([1]))


def hmac256(m, k):
if type(m) != bytes and type(m) != bytearray:
if type(m) is not bytes and type(m) is not bytearray:
m = m.encode("utf-8")
if type(k) != bytes and type(k) != bytearray:
if type(k) is not bytes and type(k) is not bytearray:
k = k.encode("utf-8")
k = bytes(k)
if len(k) > HMAC_BLOCK_SIZE:
Expand Down

0 comments on commit a2a912a

Please sign in to comment.