python3 support

This commit is contained in:
canghaiwuhen 2022-03-30 03:27:58 +00:00 committed by Philipp Maier
parent b456b1bb68
commit 0e73184c17
9 changed files with 11 additions and 11 deletions

View File

@ -351,7 +351,7 @@ def write_dict(dict, fd):
rec = dict[k]
if isinstance(rec, list) and \
len(rec) == [isinstance(i, int) for i in rec].count(True):
rec = ''.join(['[', ', '.join(map(hex, rec)), ']'])
rec = ''.join(['[', ', '.join(list(map(hex, rec))), ']'])
fd.write('%s: %s\n' % (k, rec))
def make_graph(FS, master_name='(0x3F, 0x00)\nMF'):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@ -52,9 +52,9 @@ def ascii_to_list(string):
# Convert an ascii hex string to numeric list
def asciihex_to_list(string):
string = string.translate(None, ':')
string = string.translate(str.maketrans('','',':'))
try:
return map(ord, string.decode("hex"))
return list(map(ord,''.join(['%c' % b for b in bytearray.fromhex(string)])))
except:
print("Warning: Invalid hex string -- ignored!")
return []