mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-04-15 07:10:56 +01:00
wa/commands: pep8 fixes
This commit is contained in:
parent
6afd710bd1
commit
c6ec7af665
@ -202,11 +202,13 @@ def create_template_workload(path, name, kind, class_name):
|
|||||||
with open(source_file, 'w') as wfh:
|
with open(source_file, 'w') as wfh:
|
||||||
wfh.write(render_template('{}_workload'.format(kind), {'name': name, 'class_name': class_name}))
|
wfh.write(render_template('{}_workload'.format(kind), {'name': name, 'class_name': class_name}))
|
||||||
|
|
||||||
|
|
||||||
def create_uiautomator_template_workload(path, name, kind, class_name):
|
def create_uiautomator_template_workload(path, name, kind, class_name):
|
||||||
uiauto_path = os.path.join(path, 'uiauto')
|
uiauto_path = os.path.join(path, 'uiauto')
|
||||||
create_uiauto_project(uiauto_path, name)
|
create_uiauto_project(uiauto_path, name)
|
||||||
create_template_workload(path, name, kind, class_name)
|
create_template_workload(path, name, kind, class_name)
|
||||||
|
|
||||||
|
|
||||||
def create_uiauto_project(path, name):
|
def create_uiauto_project(path, name):
|
||||||
package_name = 'com.arm.wa.uiauto.' + name.lower()
|
package_name = 'com.arm.wa.uiauto.' + name.lower()
|
||||||
|
|
||||||
@ -239,14 +241,15 @@ def create_uiauto_project(path, 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,
|
||||||
'apk' : create_template_workload,
|
'apk': create_template_workload,
|
||||||
'revent' : create_template_workload,
|
'revent': create_template_workload,
|
||||||
'apkrevent' : create_template_workload,
|
'apkrevent': create_template_workload,
|
||||||
'uiauto' : create_uiautomator_template_workload,
|
'uiauto': create_uiautomator_template_workload,
|
||||||
'apkuiauto' : create_uiautomator_template_workload,
|
'apkuiauto': create_uiautomator_template_workload,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Utility functions
|
# Utility functions
|
||||||
def render_template(name, params):
|
def render_template(name, params):
|
||||||
filepath = os.path.join(TEMPLATES_DIR, name)
|
filepath = os.path.join(TEMPLATES_DIR, name)
|
||||||
@ -260,6 +263,7 @@ def get_class_name(name, postfix=''):
|
|||||||
name = identifier(name)
|
name = identifier(name)
|
||||||
return ''.join(map(capitalize, name.split('_'))) + postfix
|
return ''.join(map(capitalize, name.split('_'))) + postfix
|
||||||
|
|
||||||
|
|
||||||
def touch(path):
|
def touch(path):
|
||||||
with open(path, 'w') as _:
|
with open(path, 'w') as _:
|
||||||
pass
|
pass
|
||||||
|
@ -48,7 +48,7 @@ class ProcessCommand(Command):
|
|||||||
Specify an output processor to add from the
|
Specify an output processor to add from the
|
||||||
command line. This can be used to run a
|
command line. This can be used to run a
|
||||||
processor that is not normally used without
|
processor that is not normally used without
|
||||||
introducing permanent change to the config
|
introducing permanent change to the config
|
||||||
(which one might then forget to revert). This
|
(which one might then forget to revert). This
|
||||||
option may be specified multiple times.
|
option may be specified multiple times.
|
||||||
""")
|
""")
|
||||||
|
@ -231,6 +231,7 @@ class RecordCommand(Command):
|
|||||||
|
|
||||||
return output_path, file_name
|
return output_path, file_name
|
||||||
|
|
||||||
|
|
||||||
class ReplayCommand(Command):
|
class ReplayCommand(Command):
|
||||||
|
|
||||||
name = 'replay'
|
name = 'replay'
|
||||||
|
@ -91,7 +91,7 @@ class RunCommand(Command):
|
|||||||
description='Run log.')
|
description='Run log.')
|
||||||
|
|
||||||
disabled_augmentations = toggle_set([i != '~~' and "~{}".format(i) or i
|
disabled_augmentations = toggle_set([i != '~~' and "~{}".format(i) or i
|
||||||
for i in args.augmentations_to_disable])
|
for i in args.augmentations_to_disable])
|
||||||
config.jobs_config.disable_augmentations(disabled_augmentations)
|
config.jobs_config.disable_augmentations(disabled_augmentations)
|
||||||
config.jobs_config.only_run_ids(args.only_run_ids)
|
config.jobs_config.only_run_ids(args.only_run_ids)
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ class RunCommand(Command):
|
|||||||
try:
|
try:
|
||||||
return init_run_output(output_directory, config, args.force)
|
return init_run_output(output_directory, config, args.force)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
if 'path exists' in str(e):
|
if 'path exists' in str(e):
|
||||||
msg = 'Output directory "{}" exists.\nPlease specify another '\
|
msg = 'Output directory "{}" exists.\nPlease specify another '\
|
||||||
'location, or use -f option to overwrite.'
|
'location, or use -f option to overwrite.'
|
||||||
self.logger.critical(msg.format(output_directory))
|
self.logger.critical(msg.format(output_directory))
|
||||||
|
@ -110,8 +110,9 @@ def get_rst_from_target(target):
|
|||||||
def get_rst_for_global_config():
|
def get_rst_for_global_config():
|
||||||
text = underline('Global Configuration')
|
text = underline('Global Configuration')
|
||||||
text += 'These parameters control the behaviour of WA/run as a whole, they ' \
|
text += 'These parameters control the behaviour of WA/run as a whole, they ' \
|
||||||
'should be set inside a config file (either located in $WA_USER_DIRECTORY/config.yaml ' \
|
'should be set inside a config file (either located in ' \
|
||||||
'or one which is specified with -c), or into config/global section of the agenda.\n\n'
|
'$WA_USER_DIRECTORY/config.yaml or one which is specified with -c), ' \
|
||||||
|
'or into config/global section of the agenda.\n\n'
|
||||||
|
|
||||||
cfg_points = MetaConfiguration.config_points + RunConfiguration.config_points
|
cfg_points = MetaConfiguration.config_points + RunConfiguration.config_points
|
||||||
text += get_params_rst(cfg_points)
|
text += get_params_rst(cfg_points)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user