mirror of https://github.com/tuhiproject/tuhi.git
Fix flake8 errors - ambiguous variable name 'l'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>pull/271/head
parent
b54ac6e99e
commit
643099b858
|
@ -12,13 +12,13 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
def list2hex(l, groupsize=8):
|
def list2hex(lst, groupsize=8):
|
||||||
'''Converts a list of integers to a two-letter hex string in the form
|
'''Converts a list of integers to a two-letter hex string in the form
|
||||||
"1a 2b c3"'''
|
"1a 2b c3"'''
|
||||||
|
|
||||||
slices = []
|
slices = []
|
||||||
for idx in range(0, len(l), groupsize):
|
for idx in range(0, len(lst), groupsize):
|
||||||
s = ' '.join([f'{x:02x}' for x in l[idx:idx + groupsize]])
|
s = ' '.join([f'{x:02x}' for x in lst[idx:idx + groupsize]])
|
||||||
slices.append(s)
|
slices.append(s)
|
||||||
|
|
||||||
return ' '.join(slices)
|
return ' '.join(slices)
|
||||||
|
|
|
@ -113,10 +113,10 @@ def b2hex(bs):
|
||||||
return ' '.join([''.join(s) for s in zip(hx[::2], hx[1::2])])
|
return ' '.join([''.join(s) for s in zip(hx[::2], hx[1::2])])
|
||||||
|
|
||||||
|
|
||||||
def list2hexlist(l):
|
def list2hexlist(lst):
|
||||||
'''Converts a list of integers to a two-letter prefixed hex string in the form
|
'''Converts a list of integers to a two-letter prefixed hex string in the form
|
||||||
"[0x1a, 0x32, 0xab]"'''
|
"[0x1a, 0x32, 0xab]"'''
|
||||||
return '[' + ', '.join([f'{x:#04x}' for x in l]) + ']'
|
return '[' + ', '.join([f'{x:#04x}' for x in lst]) + ']'
|
||||||
|
|
||||||
|
|
||||||
class DataLogger(object):
|
class DataLogger(object):
|
||||||
|
|
Loading…
Reference in New Issue