python3 support
This commit is contained in:
parent
b456b1bb68
commit
62235aa9c9
|
@ -351,7 +351,7 @@ def write_dict(dict, fd):
|
||||||
rec = dict[k]
|
rec = dict[k]
|
||||||
if isinstance(rec, list) and \
|
if isinstance(rec, list) and \
|
||||||
len(rec) == [isinstance(i, int) for i in rec].count(True):
|
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))
|
fd.write('%s: %s\n' % (k, rec))
|
||||||
|
|
||||||
def make_graph(FS, master_name='(0x3F, 0x00)\nMF'):
|
def make_graph(FS, master_name='(0x3F, 0x00)\nMF'):
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
6
utils.py
6
utils.py
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -52,9 +52,9 @@ def ascii_to_list(string):
|
||||||
# Convert an ascii hex string to numeric list
|
# Convert an ascii hex string to numeric list
|
||||||
def asciihex_to_list(string):
|
def asciihex_to_list(string):
|
||||||
|
|
||||||
string = string.translate(None, ':')
|
string = string.translate(str.maketrans('','',':'))
|
||||||
try:
|
try:
|
||||||
return map(ord, string.decode("hex"))
|
return list(map(ord,''.join(['%c' % b for b in bytearray.fromhex(string)])))
|
||||||
except:
|
except:
|
||||||
print("Warning: Invalid hex string -- ignored!")
|
print("Warning: Invalid hex string -- ignored!")
|
||||||
return []
|
return []
|
||||||
|
|
Loading…
Reference in New Issue