python3 support
This commit is contained in:
parent
b456b1bb68
commit
0e73184c17
|
@ -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'):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
|
|
6
utils.py
6
utils.py
|
@ -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 []
|
||||
|
|
Loading…
Reference in New Issue