Fix is parameter is already an int

pull/8/head
Nicolas Jouanin 2015-06-12 23:20:52 +02:00
rodzic 0c97edd020
commit 3dba18fb84
1 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -22,7 +22,10 @@ def bytes_to_int(data):
:param data: byte sequence
:return: integer value
"""
return int.from_bytes(data, byteorder='big')
if isinstance(data, int):
return data
else:
return int.from_bytes(data, byteorder='big')
def int_to_bytes(int_value: int, length=-1) -> bytes:
"""