mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-08-10 22:41:51 +02:00
add hexlify compatibility for python 3.6 and 3.7
This commit is contained in:
@@ -235,7 +235,12 @@ def _i2b(integer: int) -> bytes:
|
|||||||
|
|
||||||
def _b2a(byte_string: bytes) -> str:
|
def _b2a(byte_string: bytes) -> str:
|
||||||
"""Convert a byte string to a colon-delimited hex ascii string"""
|
"""Convert a byte string to a colon-delimited hex ascii string"""
|
||||||
|
# need try/except since seperator was only introduced in python 3.8.
|
||||||
|
# provides compatibility for python 3.6 and 3.7.
|
||||||
|
try:
|
||||||
return binascii.hexlify(byte_string, ':').decode('utf-8')
|
return binascii.hexlify(byte_string, ':').decode('utf-8')
|
||||||
|
except TypeError:
|
||||||
|
return binascii.hexlify(byte_string).decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
def _fix_objects(obj):
|
def _fix_objects(obj):
|
||||||
|
Reference in New Issue
Block a user