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

wa: pep8 fixes

This commit is contained in:
Marc Bonnici 2018-07-04 17:44:55 +01:00
parent 4b86fa5aee
commit 925bc8b719
36 changed files with 88 additions and 86 deletions

View File

@ -46,6 +46,7 @@ class ListCommand(Command):
Only list results that are supported by the
specified platform.
''')
# pylint: disable=superfluous-parens
def execute(self, state, args):
filters = {}

View File

@ -26,7 +26,7 @@ from wa.utils.revent import ReventRecorder
if sys.version_info[0] == 3:
raw_input = input #pylint: disable=redefined-builtin
raw_input = input # pylint: disable=redefined-builtin
class RecordCommand(Command):

View File

@ -199,7 +199,7 @@ class SysfileValuesRuntimeConfig(RuntimeConfig):
name = 'rt-sysfiles'
#pylint: disable=unused-argument
# pylint: disable=unused-argument
@staticmethod
def set_sysfile(obj, values, core):
for path, value in values.items():

View File

@ -14,7 +14,7 @@
#
#pylint: disable=W0613,E1101,E0203,W0201
# pylint: disable=W0613,E1101,E0203,W0201
import time
from wa import Instrument, Parameter

View File

@ -38,7 +38,7 @@ class DmesgInstrument(Instrument):
loglevel_file = '/proc/sys/kernel/printk'
def initialize(self, context): #pylint: disable=unused-argument
def initialize(self, context): # pylint: disable=unused-argument
self.need_root = self.target.os == 'android'
if self.need_root and not self.target.is_rooted:
raise InstrumentError('Need root to collect dmesg on Android')

View File

@ -60,7 +60,7 @@ class EnergyInstrumentBackend(Plugin):
Typically there is just a single device/instrument, in which case the
device key is arbitrary.
"""
return {None: self.instrument(target, **kwargs)} #pylint: disable=not-callable
return {None: self.instrument(target, **kwargs)} # pylint: disable=not-callable
class DAQBackend(EnergyInstrumentBackend):
@ -284,7 +284,7 @@ class AcmeCapeBackend(EnergyInstrumentBackend):
"""),
]
#pylint: disable=arguments-differ
# pylint: disable=arguments-differ
def get_instruments(self, target, metadir,
iio_capture, host, iio_devices, buffer_size):
@ -429,7 +429,7 @@ class EnergyMeasurement(Instrument):
self.instruments = self.backend.get_instruments(self.target, context.run_output.metadir, **self.params)
for instrument in self.instruments.values():
if not (instrument.mode & CONTINUOUS): #pylint: disable=superfluous-parens
if not (instrument.mode & CONTINUOUS): # pylint: disable=superfluous-parens
msg = '{} instrument does not support continuous measurement collection'
raise ConfigError(msg.format(self.instrument))
instrument.setup()

View File

@ -119,7 +119,7 @@ class FpsInstrument(Instrument):
return
self._is_enabled = True
#pylint: disable=redefined-variable-type
# pylint: disable=redefined-variable-type
if use_gfxinfo:
self.collector = GfxInfoFramesInstrument(self.target, collector_target, self.period)
self.processor = DerivedGfxInfoStats(self.drop_threshold, filename='fps.csv')
@ -128,12 +128,12 @@ class FpsInstrument(Instrument):
self.processor = DerivedSurfaceFlingerStats(self.drop_threshold, filename='fps.csv')
self.collector.reset()
def start(self, context): #pylint: disable=unused-argument
def start(self, context): # pylint: disable=unused-argument
if not self._is_enabled:
return
self.collector.start()
def stop(self, context): #pylint: disable=unused-argument
def stop(self, context): # pylint: disable=unused-argument
if not self._is_enabled:
return
self.collector.stop()

View File

@ -41,18 +41,18 @@ class HwmonInstrument(Instrument):
hwmon data will be reported.
"""
def initialize(self, context): #pylint: disable=unused-argument
def initialize(self, context): # pylint: disable=unused-argument
self.instrument = _Instrument(self.target)
def setup(self, context): #pylint: disable=unused-argument
def setup(self, context): # pylint: disable=unused-argument
self.instrument.reset()
@fast
def start(self, context): #pylint: disable=unused-argument
def start(self, context): # pylint: disable=unused-argument
self.before = self.instrument.take_measurement()
@fast
def stop(self, context): #pylint: disable=unused-argument
def stop(self, context): # pylint: disable=unused-argument
self.after = self.instrument.take_measurement()
def update_output(self, context):
@ -85,5 +85,5 @@ class HwmonInstrument(Instrument):
"Don't know what to do with hwmon channel '{}'"
.format(measurement_after.channel))
def teardown(self, context): #pylint: disable=unused-argument
def teardown(self, context): # pylint: disable=unused-argument
self.instrument.teardown()

View File

@ -50,8 +50,8 @@ class ScreenCaptureInstrument(Instrument):
output_path,
self.period)
def start(self, context): #pylint: disable=unused-argument
def start(self, context): # pylint: disable=unused-argument
self.collector.start()
def stop(self, context): #pylint: disable=unused-argument
def stop(self, context): # pylint: disable=unused-argument
self.collector.stop()

View File

@ -88,7 +88,7 @@ class CpuStatesProcessor(OutputProcessor):
def initialize(self):
self.iteration_reports = OrderedDict()
def process_job_output(self, output, target_info, run_output): #pylint: disable=unused-argument
def process_job_output(self, output, target_info, run_output): # pylint: disable=unused-argument
trace_file = output.get_artifact_path('trace-cmd-txt')
if not trace_file:
self.logger.warning('Text trace does not appear to have been generated; skipping this iteration.')
@ -110,7 +110,7 @@ class CpuStatesProcessor(OutputProcessor):
iteration_id = (output.id, output.label, output.iteration)
self.iteration_reports[iteration_id] = reports
#pylint: disable=too-many-locals,unused-argument
# pylint: disable=too-many-locals,unused-argument
def process_run_output(self, output, target_info):
if not self.iteration_reports:
self.logger.warning('No power state reports generated.')

View File

@ -60,7 +60,7 @@ class CsvReportProcessor(OutputProcessor):
self.outputs_so_far = [] # pylint: disable=attribute-defined-outside-init
self.artifact_added = False
#pylint: disable=unused-argument
# pylint: disable=unused-argument
def process_job_output(self, output, target_info, run_output):
self.outputs_so_far.append(output)
self._write_outputs(self.outputs_so_far, run_output)
@ -68,7 +68,7 @@ class CsvReportProcessor(OutputProcessor):
run_output.add_artifact('run_result_csv', 'results.csv', 'export')
self.artifact_added = True
def process_run_output(self, output, target_info): #pylint: disable=unused-argument
def process_run_output(self, output, target_info): # pylint: disable=unused-argument
self.outputs_so_far.append(output)
self._write_outputs(self.outputs_so_far, output)
if not self.artifact_added:

View File

@ -115,7 +115,7 @@ class SqliteResultProcessor(OutputProcessor):
self._spec_oid = None
self._run_initialized = False
def export_job_output(self, job_output, target_info, run_output): #pylint: disable=unused-argument
def export_job_output(self, job_output, target_info, run_output): # pylint: disable=unused-argument
if not self._run_initialized:
self._init_run(run_output)
@ -128,7 +128,7 @@ class SqliteResultProcessor(OutputProcessor):
with self._open_connection() as conn:
conn.executemany('INSERT INTO metrics VALUES (?,?,?,?,?,?)', metrics)
def export_run_output(self, run_output, target_info): #pylint: disable=unused-argument
def export_run_output(self, run_output, target_info): # pylint: disable=unused-argument
if not self._run_initialized:
self._init_run(run_output)

View File

@ -30,7 +30,7 @@ class StatusTxtReporter(OutputProcessor):
"""
def process_run_output(self, output, target_info): #pylint: disable=unused-argument
def process_run_output(self, output, target_info): # pylint: disable=unused-argument
counter = Counter()
for jo in output.jobs:
counter[jo.status] += 1

View File

@ -61,7 +61,7 @@ class TargzProcessor(OutputProcessor):
self.logger.debug('Registering RUN_FINALIZED handler.')
signal.connect(self.delete_output_directory, signal.RUN_FINALIZED, priority=-100)
def export_run_output(self, run_output, target_info): #pylint: disable=unused-argument
def export_run_output(self, run_output, target_info): # pylint: disable=unused-argument
if self.outfile:
outfile_path = self.outfile.format(**run_output.info.to_pod())
else:

View File

@ -30,7 +30,7 @@ class UxperfProcessor(OutputProcessor):
a agenda file by setting ``markers_enabled`` for the workload to ``True``.
'''
#pylint: disable=too-many-locals,unused-argument
# pylint: disable=too-many-locals,unused-argument
def process_job_output(self, output, target_info, job_output):
logcat = output.get_artifact('logcat')
if not logcat:

View File

@ -57,7 +57,7 @@ class LogcatParser(object):
if event:
yield event
def parse_line(self, line): #pylint: disable=no-self-use
def parse_line(self, line): # pylint: disable=no-self-use
line = line.strip()
if not line or line.startswith('-') or ': ' not in line:
return None

View File

@ -18,7 +18,7 @@ import re
import logging
from builtins import zip #pyline disable=redefined-builtin
from builtins import zip # pylint: disable=redefined-builtin
from future.moves.itertools import zip_longest
from wa.utils.misc import diff_tokens, write_table
@ -26,6 +26,7 @@ from wa.utils.misc import ensure_file_directory_exists as _f
logger = logging.getLogger('diff')
def diff_interrupt_files(before, after, result): # pylint: disable=R0914
output_lines = []
with open(before) as bfh:

View File

@ -24,7 +24,7 @@ def activate_environment(name):
environment with that name does not already exist, it will be
created.
"""
#pylint: disable=W0603
# pylint: disable=W0603
global __active_environment
if name not in list(__environments.keys()):

View File

@ -49,7 +49,8 @@ _indent_width = 4
_console_handler = None
_init_handler = None
#pylint: disable=global-statement
# pylint: disable=global-statement
def init(verbosity=logging.INFO, color=True, indent_with=4,
regular_fmt='%(levelname)-8s %(message)s',
verbose_fmt='%(asctime)s %(levelname)-8s %(name)10.10s: %(message)s',
@ -95,7 +96,7 @@ def set_level(level):
_console_handler.setLevel(level)
#pylint: disable=global-statement
# pylint: disable=global-statement
def add_file(filepath, level=logging.DEBUG,
fmt='%(asctime)s %(levelname)-8s %(name)10.10s: %(message)s'):
global _init_handler
@ -140,13 +141,13 @@ def __disable_logger(logger):
logger.propagate = False
#pylint: disable=global-statement
# pylint: disable=global-statement
def indent():
global _indent_level
_indent_level += 1
#pylint: disable=global-statement
# pylint: disable=global-statement
def dedent():
global _indent_level
_indent_level -= 1
@ -161,7 +162,7 @@ def indentcontext():
dedent()
#pylint: disable=global-statement
# pylint: disable=global-statement
def set_indent_level(level):
global _indent_level
old_level = _indent_level

View File

@ -418,7 +418,8 @@ def categorize(v):
else:
return 'c'
#pylint: disable=too-many-return-statements,too-many-branches
# pylint: disable=too-many-return-statements,too-many-branches
def merge_config_values(base, other):
"""
This is used to merge two objects, typically when setting the value of a

View File

@ -65,7 +65,7 @@ from datetime import datetime
import yaml as _yaml
import dateutil.parser
#pylint: disable=redefined-builtin
# pylint: disable=redefined-builtin
from past.builtins import basestring
from wa.framework.exception import SerializerSyntaxError
@ -351,7 +351,7 @@ def _write_pod(pod, wfh, fmt=None):
def is_pod(obj):
if type(obj) not in POD_TYPES: #pylint: disable=unidiomatic-typecheck
if type(obj) not in POD_TYPES: # pylint: disable=unidiomatic-typecheck
return False
if hasattr(obj, 'items'):
for k, v in obj.items():

View File

@ -266,7 +266,7 @@ class TraceCmdParser(object):
by trace-cmd
"""
inside_maked_region = False
#pylint: disable=superfluous-parens
# pylint: disable=superfluous-parens
filters = [re.compile('^{}$'.format(e)) for e in (self.events or [])]
filter_markers = self.filter_markers
if filter_markers and self.check_for_markers:

View File

@ -32,12 +32,12 @@ import shlex
import sys
from bisect import insort
if sys.version_info[0] == 3:
from urllib.parse import quote, unquote #pylint: disable=no-name-in-module, import-error
from past.builtins import basestring #pylint: disable=redefined-builtin
from urllib.parse import quote, unquote # pylint: disable=no-name-in-module, import-error
from past.builtins import basestring # pylint: disable=redefined-builtin
long = int
else:
from urllib import quote, unquote
#pylint: disable=wrong-import-position
# pylint: disable=wrong-import-position
from collections import defaultdict, MutableMapping
from copy import copy
from functools import total_ordering

View File

@ -55,7 +55,7 @@ class Antutu(ApkUiautoWorkload):
try:
result = float(match.group(1))
except ValueError:
result = 'NaN' #pylint: disable=redefined-variable-type
result = 'NaN' # pylint: disable=redefined-variable-type
entry = regex.pattern.rsplit(None, 1)[0]
context.add_metric(entry, result, lower_is_better=False)
expected_results -= 1

View File

@ -15,11 +15,11 @@
from __future__ import division
import os
#pylint: disable=wrong-import-order,wrong-import-position
# pylint: disable=wrong-import-order,wrong-import-position
from future.standard_library import install_aliases
install_aliases()
from urllib.request import urlopen #pylint: disable=import-error
from urllib.request import urlopen # pylint: disable=import-error
from wa import Workload, Parameter, Alias, WorkloadError
from wa.utils.exec_control import once
@ -99,7 +99,7 @@ class ApacheBenchmark(Workload):
wfh.write(self.output)
context.add_artifact('ab-output', outfile, kind='raw')
def update_output(self, context): #pylint: disable=too-many-locals
def update_output(self, context): # pylint: disable=too-many-locals
with open(context.get_artifact_path('ab-output')) as fh:
server_software = get_line(fh, 'Server Software').split(':')[1].strip()
context.add_metadata('server-software', server_software)

View File

@ -92,7 +92,7 @@ class Applaunch(ApkUiautoWorkload):
def init_resources(self, context):
super(Applaunch, self).init_resources(context)
self.workload_params['markers_enabled'] = True
#pylint: disable=no-member
# pylint: disable=no-member
self.workload = pluginloader.get_workload(self.workload_name, self.target,
**self.workload_params)
self.workload.init_resources(context)

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
#pylint: disable=E1101,W0201
# pylint: disable=E1101,W0201
import os
import re

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
#pylint: disable=E1101,W0201
# pylint: disable=E1101,W0201
import os
import re

View File

@ -19,11 +19,11 @@ import re
import os
import time
#pylint: disable=wrong-import-position
# pylint: disable=wrong-import-position
from future.standard_library import install_aliases
install_aliases()
#pylint: disable=import-error, wrong-import-order
# pylint: disable=import-error, wrong-import-order
import urllib.request
import urllib.parse
import urllib.error
@ -113,7 +113,7 @@ class ExoPlayer(ApkWorkload):
"""),
]
#pylint: disable=access-member-before-definition
# pylint: disable=access-member-before-definition
def validate(self):
if self.format and self.filename:
raise ConfigError('Either format *or* filename must be specified; but not both.')
@ -156,7 +156,7 @@ class ExoPlayer(ApkWorkload):
'"format" to specify a different file.')
return files[0]
def init_resources(self, context): #pylint: disable=unused-argument
def init_resources(self, context): # pylint: disable=unused-argument
# Needs to happen first, as it sets self.format, which is required by
# _find_host_video_file
self.validate()

View File

@ -291,33 +291,31 @@ class GBScoreCalculator(object):
'memory': 0.1926489,
'stream': 0.1054738,
}
#pylint: disable=C0326
# pylint: disable=C0326
workloads = [
# ID Name Power Mac ST Power Mac MT
GBWorkload(101, 'Blowfish', 43971, 40979),
GBWorkload(102, 'Text Compress', 3202, 3280),
GBWorkload(103, 'Text Decompress', 4112, 3986),
GBWorkload(104, 'Image Compress', 8272, 8412),
GBWorkload(105, 'Image Decompress', 16800, 16330),
GBWorkload(107, 'Lua', 385, 385),
GBWorkload(101, 'Blowfish', 43971, 40979), # NOQA
GBWorkload(102, 'Text Compress', 3202, 3280), # NOQA
GBWorkload(103, 'Text Decompress', 4112, 3986), # NOQA
GBWorkload(104, 'Image Compress', 8272, 8412), # NOQA
GBWorkload(105, 'Image Decompress', 16800, 16330), # NOQA
GBWorkload(107, 'Lua', 385, 385), # NOQA
GBWorkload(201, 'Mandelbrot', 665589, 653746),
GBWorkload(202, 'Dot Product', 481449, 455422),
GBWorkload(203, 'LU Decomposition', 889933, 877657),
GBWorkload(204, 'Primality Test', 149394, 185502),
GBWorkload(205, 'Sharpen Image', 2340, 2304),
GBWorkload(206, 'Blur Image', 791, 787),
GBWorkload(201, 'Mandelbrot', 665589, 653746), # NOQA),
GBWorkload(202, 'Dot Product', 481449, 455422), # NOQA,
GBWorkload(203, 'LU Decomposition', 889933, 877657), # NOQA
GBWorkload(204, 'Primality Test', 149394, 185502), # NOQA
GBWorkload(205, 'Sharpen Image', 2340, 2304), # NOQA
GBWorkload(206, 'Blur Image', 791, 787), # NOQA
GBWorkload(302, 'Read Sequential', 1226708, None),
GBWorkload(304, 'Write Sequential', 683782, None),
GBWorkload(306, 'Stdlib Allocate', 3739, None),
GBWorkload(307, 'Stdlib Write', 2070681, None),
GBWorkload(308, 'Stdlib Copy', 1030360, None),
GBWorkload(401, 'Stream Copy', 1367892, None),
GBWorkload(402, 'Stream Scale', 1296053, None),
GBWorkload(403, 'Stream Add', 1507115, None),
GBWorkload(404, 'Stream Triad', 1384526, None),
GBWorkload(302, 'Read Sequential', 1226708, None), # NOQA
GBWorkload(304, 'Write Sequential', 683782, None), # NOQA
GBWorkload(306, 'Stdlib Allocate', 3739, None), # NOQA
GBWorkload(307, 'Stdlib Write', 2070681, None), # NOQA
GBWorkload(401, 'Stream Copy', 1367892, None), # NOQA
GBWorkload(402, 'Stream Scale', 1296053, None), # NOQA
GBWorkload(403, 'Stream Add', 1507115, None), # NOQA
GBWorkload(404, 'Stream Triad', 1384526, None), # NOQA
]
def __init__(self):
@ -389,7 +387,7 @@ class GBScoreCalculator(object):
context.add_metric('Geekbench Score', int(overall_score))
class GeekbenchCorproate(Geekbench): #pylint: disable=too-many-ancestors
class GeekbenchCorproate(Geekbench): # pylint: disable=too-many-ancestors
name = "geekbench-corporate"
is_corporate = True
requires_network = False

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
#pylint: disable=E1101,W0201
# pylint: disable=E1101,W0201
import os
import re

View File

@ -129,7 +129,7 @@ class Jankbench(ApkWorkload):
else:
self.extract_metrics_from_logcat(context)
def extract_metrics_from_db(self, context): #pylint: disable=no-self-use
def extract_metrics_from_db(self, context): # pylint: disable=no-self-use
dbfile = context.get_artifact_path('jankbench-results')
with sqlite3.connect(dbfile) as conn:
df = pd.read_sql('select name, iteration, total_duration, jank_frame from ui_results', conn)

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
#pylint: disable=E1101,W0201
# pylint: disable=E1101,W0201
import os

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
#pylint: disable=E1101,W0201
# pylint: disable=E1101,W0201
import os
import re