Fix flake8 errors - ambiguous variable name 'l'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
pull/271/head
Peter Hutterer 2021-01-22 16:43:54 +10:00
parent b54ac6e99e
commit 643099b858
2 changed files with 5 additions and 5 deletions

View File

@ -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
"1a 2b c3"'''
slices = []
for idx in range(0, len(l), groupsize):
s = ' '.join([f'{x:02x}' for x in l[idx:idx + groupsize]])
for idx in range(0, len(lst), groupsize):
s = ' '.join([f'{x:02x}' for x in lst[idx:idx + groupsize]])
slices.append(s)
return ' '.join(slices)

View File

@ -113,10 +113,10 @@ def b2hex(bs):
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
"[0x1a, 0x32, 0xab]"'''
return '[' + ', '.join([f'{x:#04x}' for x in l]) + ']'
return '[' + ', '.join([f'{x:#04x}' for x in lst]) + ']'
class DataLogger(object):