1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

wa: PEP8 Fixes

This commit is contained in:
Marc Bonnici 2018-07-09 17:57:35 +01:00 committed by setrofim
parent 97cf0ac059
commit e8b0d42758
4 changed files with 12 additions and 9 deletions

View File

@ -240,6 +240,7 @@ def create_uiauto_project(path, name):
wfh.write(render_template(os.path.join('uiauto', 'UiAutomation.java'), wfh.write(render_template(os.path.join('uiauto', 'UiAutomation.java'),
{'name': name, 'package_name': package_name})) {'name': name, 'package_name': package_name}))
# Mapping of workload types to their corresponding creation method # Mapping of workload types to their corresponding creation method
create_funcs = { create_funcs = {
'basic': create_template_workload, 'basic': create_template_workload,
@ -266,5 +267,5 @@ def get_class_name(name, postfix=''):
def touch(path): def touch(path):
with open(path, 'w') as _: with open(path, 'w') as _: # NOQA
pass pass

View File

@ -61,7 +61,7 @@ def _get_terminal_size_windows():
sizex = right - left + 1 sizex = right - left + 1
sizey = bottom - top + 1 sizey = bottom - top + 1
return sizex, sizey return sizex, sizey
except: except: # NOQA
pass pass
@ -72,7 +72,7 @@ def _get_terminal_size_tput():
cols = int(subprocess.check_call(shlex.split('tput cols'))) cols = int(subprocess.check_call(shlex.split('tput cols')))
rows = int(subprocess.check_call(shlex.split('tput lines'))) rows = int(subprocess.check_call(shlex.split('tput lines')))
return (cols, rows) return (cols, rows)
except: except: # NOQA
pass pass
@ -84,7 +84,7 @@ def _get_terminal_size_linux():
cr = struct.unpack('hh', cr = struct.unpack('hh',
fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
return cr return cr
except: except: # NOQA
pass pass
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
if not cr: if not cr:
@ -92,12 +92,12 @@ def _get_terminal_size_linux():
fd = os.open(os.ctermid(), os.O_RDONLY) fd = os.open(os.ctermid(), os.O_RDONLY)
cr = ioctl_GWINSZ(fd) cr = ioctl_GWINSZ(fd)
os.close(fd) os.close(fd)
except: except: # NOQA
pass pass
if not cr: if not cr:
try: try:
cr = (os.environ['LINES'], os.environ['COLUMNS']) cr = (os.environ['LINES'], os.environ['COLUMNS'])
except: except: # NOQA
return None return None
return int(cr[1]), int(cr[0]) return int(cr[1]), int(cr[0])

View File

@ -59,6 +59,7 @@ def list_of_strs(value):
raise ValueError(value) raise ValueError(value)
return list(map(str, value)) return list(map(str, value))
list_of_strings = list_of_strs list_of_strings = list_of_strs
@ -71,6 +72,7 @@ def list_of_ints(value):
raise ValueError(value) raise ValueError(value)
return list(map(int, value)) return list(map(int, value))
list_of_integers = list_of_ints list_of_integers = list_of_ints
@ -652,8 +654,8 @@ def enum(args, start=0, step=1):
n += step n += step
setattr(Enum, 'levels', levels) setattr(Enum, 'levels', levels)
setattr(Enum, 'values', [lv.value for lv in levels]) setattr(Enum, 'values', [lvl.value for lvl in levels])
setattr(Enum, 'names', [lv.name for lv in levels]) setattr(Enum, 'names', [lvl.name for lvl in levels])
return Enum return Enum