1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

Updated pylint for v1.5.1

Fixed WA for the latest version of pylint (1.5.1)
This commit is contained in:
Sebastian Goscik 2015-12-09 15:43:35 +00:00
parent 344bc519c4
commit bef8fb40ef
35 changed files with 86 additions and 102 deletions

View File

@ -35,10 +35,10 @@ compare_versions() {
} }
pylint_version=$(python -c 'from pylint.__pkginfo__ import version; print version') pylint_version=$(python -c 'from pylint.__pkginfo__ import version; print version')
compare_versions $pylint_version "1.3.0" compare_versions $pylint_version "1.5.1"
result=$? result=$?
if [ "$result" == "2" ]; then if [ "$result" == "2" ]; then
echo "ERROR: pylint version must be at least 1.3.0; found $pylint_version" echo "ERROR: pylint version must be at least 1.5.1; found $pylint_version"
exit 1 exit 1
fi fi

View File

@ -16,7 +16,7 @@
# #
[MASTER] [MASTER]
profile=no #profile=no
ignore=external ignore=external

View File

@ -164,7 +164,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
raise DeviceError('Could not boot {} ({}).'.format(self.name, self.adb_name)) raise DeviceError('Could not boot {} ({}).'.format(self.name, self.adb_name))
while iteration_number < max_iterations: while iteration_number < max_iterations:
available = (1 == int('0' + adb_shell(self.adb_name, 'getprop sys.boot_completed', timeout=self.default_timeout))) available = (int('0' + (adb_shell(self.adb_name, 'getprop sys.boot_completed', timeout=self.default_timeout))) == 1)
if available: if available:
break break
else: else:
@ -331,10 +331,7 @@ class AndroidDevice(BaseLinuxDevice): # pylint: disable=W0223
self._check_ready() self._check_ready()
output = adb_shell(self.adb_name, 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath), output = adb_shell(self.adb_name, 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath),
timeout=self.default_timeout) timeout=self.default_timeout)
if int(output): return bool(int(output))
return True
else:
return False
def install(self, filepath, timeout=default_timeout, with_name=None): # pylint: disable=W0221 def install(self, filepath, timeout=default_timeout, with_name=None): # pylint: disable=W0221
ext = os.path.splitext(filepath)[1].lower() ext = os.path.splitext(filepath)[1].lower()
@ -739,4 +736,3 @@ class BigLittleDevice(AndroidDevice): # pylint: disable=W0223
parameters = [ parameters = [
Parameter('scheduler', default='hmp', override=True), Parameter('scheduler', default='hmp', override=True),
] ]

View File

@ -248,7 +248,7 @@ class BaseLinuxDevice(Device): # pylint: disable=abstract-method
self.execute('echo {} > \'{}\''.format(value, sysfile), check_exit_code=False, as_root=True) self.execute('echo {} > \'{}\''.format(value, sysfile), check_exit_code=False, as_root=True)
if verify: if verify:
output = self.get_sysfile_value(sysfile) output = self.get_sysfile_value(sysfile)
if not output.strip() == value: # pylint: disable=E1103 if output.strip() != value: # pylint: disable=E1103
message = 'Could not set the value of {} to {}'.format(sysfile, value) message = 'Could not set the value of {} to {}'.format(sysfile, value)
raise DeviceError(message) raise DeviceError(message)
self._written_sysfiles.append(sysfile) self._written_sysfiles.append(sysfile)
@ -476,7 +476,7 @@ class BaseLinuxDevice(Device): # pylint: disable=abstract-method
if isinstance(on_cpus, basestring): if isinstance(on_cpus, basestring):
on_cpus = ranges_to_list(on_cpus) on_cpus = ranges_to_list(on_cpus)
if isiterable(on_cpus): if isiterable(on_cpus):
on_cpus = list_to_mask(on_cpus) on_cpus = list_to_mask(on_cpus) # pylint: disable=redefined-variable-type
command = '{} taskset 0x{:x} {}'.format(self.busybox, on_cpus, command) command = '{} taskset 0x{:x} {}'.format(self.busybox, on_cpus, command)
if in_directory: if in_directory:
command = 'cd {} && {}'.format(in_directory, command) command = 'cd {} && {}'.format(in_directory, command)
@ -807,4 +807,3 @@ class LinuxDevice(BaseLinuxDevice):
def ensure_screen_is_on(self): def ensure_screen_is_on(self):
pass # TODO pass # TODO

View File

@ -16,13 +16,12 @@
import os import os
from copy import copy from copy import copy
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
import yaml
from wlauto.exceptions import ConfigError from wlauto.exceptions import ConfigError
from wlauto.utils.misc import load_struct_from_yaml, LoadSyntaxError from wlauto.utils.misc import load_struct_from_yaml, LoadSyntaxError
from wlauto.utils.types import counter, reset_counter from wlauto.utils.types import counter, reset_counter
import yaml
def get_aliased_param(d, aliases, default=None, pop=True): def get_aliased_param(d, aliases, default=None, pop=True):
alias_map = [i for i, a in enumerate(aliases) if a in d] alias_map = [i for i, a in enumerate(aliases) if a in d]

View File

@ -303,7 +303,7 @@ class Device(Extension):
params = OrderedDict((k.lower(), v) for k, v in params.iteritems() if v is not None) params = OrderedDict((k.lower(), v) for k, v in params.iteritems() if v is not None)
expected_keys = rtp_map.keys() expected_keys = rtp_map.keys()
if not set(params.keys()) <= set(expected_keys): if not set(params.keys()).issubset(set(expected_keys)):
unknown_params = list(set(params.keys()).difference(set(expected_keys))) unknown_params = list(set(params.keys()).difference(set(expected_keys)))
raise ConfigError('Unknown runtime parameter(s): {}'.format(unknown_params)) raise ConfigError('Unknown runtime parameter(s): {}'.format(unknown_params))
@ -447,4 +447,3 @@ class Device(Extension):
except Exception as e: except Exception as e:
self.ping() self.ping()
raise e raise e

View File

@ -18,6 +18,7 @@ import sys
import argparse import argparse
import logging import logging
import subprocess import subprocess
import warnings
from wlauto.core.bootstrap import settings from wlauto.core.bootstrap import settings
from wlauto.core.extension_loader import ExtensionLoader from wlauto.core.extension_loader import ExtensionLoader
@ -28,7 +29,6 @@ from wlauto.utils.cli import init_argument_parser
from wlauto.utils.doc import format_body from wlauto.utils.doc import format_body
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='zope') warnings.filterwarnings(action='ignore', category=UserWarning, module='zope')
@ -89,4 +89,3 @@ def main():
logging.critical(tb) logging.critical(tb)
logging.critical('{}({})'.format(e.__class__.__name__, e)) logging.critical('{}({})'.format(e.__class__.__name__, e))
sys.exit(2) sys.exit(2)

View File

@ -80,7 +80,7 @@ class GlobalParameterAlias(object):
other_param.kind != param.kind): other_param.kind != param.kind):
message = 'Duplicate global alias {} declared in {} and {} extensions with different types' message = 'Duplicate global alias {} declared in {} and {} extensions with different types'
raise LoaderError(message.format(self.name, ext.name, other_ext.name)) raise LoaderError(message.format(self.name, ext.name, other_ext.name))
if not param.name == other_param.name: if param.name != other_param.name:
message = 'Two params {} in {} and {} in {} both declare global alias {}' message = 'Two params {} in {} and {} in {} both declare global alias {}'
raise LoaderError(message.format(param.name, ext.name, raise LoaderError(message.format(param.name, ext.name,
other_param.name, other_ext.name, self.name)) other_param.name, other_ext.name, self.name))
@ -320,7 +320,7 @@ class ExtensionLoader(object):
if should_skip: if should_skip:
continue continue
for fname in files: for fname in files:
if not os.path.splitext(fname)[1].lower() == '.py': if os.path.splitext(fname)[1].lower() != '.py':
continue continue
filepath = os.path.join(root, fname) filepath = os.path.join(root, fname)
try: try:
@ -401,4 +401,3 @@ def _instantiate(cls, args=None, kwargs=None):
return cls(*args, **kwargs) return cls(*args, **kwargs)
except Exception: except Exception:
raise LoaderError('Could not load {}'.format(cls), sys.exc_info()) raise LoaderError('Could not load {}'.format(cls), sys.exc_info())

View File

@ -98,8 +98,8 @@ class Gem5AndroidDevice(BaseGem5Device, AndroidDevice):
self.logger.info("Waiting for Android to boot...") self.logger.info("Waiting for Android to boot...")
while True: while True:
try: try:
booted = (1 == int('0' + self.gem5_shell('getprop sys.boot_completed', check_exit_code=False))) booted = (int('0' + self.gem5_shell('getprop sys.boot_completed', check_exit_code=False)) == 1)
anim_finished = (1 == int('0' + self.gem5_shell('getprop service.bootanim.exit', check_exit_code=False))) anim_finished = (int('0' + self.gem5_shell('getprop service.bootanim.exit', check_exit_code=False)) == 1)
if booted and anim_finished: if booted and anim_finished:
break break
except (DeviceError, ValueError): except (DeviceError, ValueError):

View File

@ -14,7 +14,7 @@
# #
# pylint: disable=E1101,E1103 # pylint: disable=E1101,E1103,wrong-import-position
import os import os
import sys import sys

View File

@ -59,7 +59,7 @@ class DeviceConfiguration(Serializable):
def validate(self): def validate(self):
if not self.number_of_ports: if not self.number_of_ports:
raise ConfigurationError('No resistor values were specified.') raise ConfigurationError('No resistor values were specified.')
if not len(self.resistor_values) == len(self.labels): if len(self.resistor_values) != len(self.labels):
message = 'The number of resistors ({}) does not match the number of labels ({})' message = 'The number of resistors ({}) does not match the number of labels ({})'
raise ConfigurationError(message.format(len(self.resistor_values), len(self.labels))) raise ConfigurationError(message.format(len(self.resistor_values), len(self.labels)))
@ -151,4 +151,3 @@ def get_config_parser(server=True, device=True):
parser.add_argument('--host', action=UpdateServerConfig) parser.add_argument('--host', action=UpdateServerConfig)
parser.add_argument('--port', action=UpdateServerConfig, type=int) parser.add_argument('--port', action=UpdateServerConfig, type=int)
return parser return parser

View File

@ -42,7 +42,7 @@ Port 0
:sampling_rate: The rate at which DAQ takes a sample from each channel. :sampling_rate: The rate at which DAQ takes a sample from each channel.
""" """
# pylint: disable=F0401,E1101,W0621,no-name-in-module # pylint: disable=F0401,E1101,W0621,no-name-in-module,wrong-import-position,wrong-import-order
import os import os
import sys import sys
import csv import csv
@ -302,7 +302,7 @@ class DaqRunner(object):
if callbacks_supported: if callbacks_supported:
self.task = ReadSamplesCallbackTask(config, self.processor) self.task = ReadSamplesCallbackTask(config, self.processor)
else: else:
self.task = ReadSamplesThreadedTask(config, self.processor) self.task = ReadSamplesThreadedTask(config, self.processor) # pylint: disable=redefined-variable-type
self.is_running = False self.is_running = False
def start(self): def start(self):
@ -334,7 +334,7 @@ if __name__ == '__main__':
resistor_values = [0.005] resistor_values = [0.005]
labels = ['PORT_0'] labels = ['PORT_0']
dev_config = DeviceConfig('Dev1', channel_map, resistor_values, 2.5, 0.2, 10000, len(resistor_values), labels) dev_config = DeviceConfig('Dev1', channel_map, resistor_values, 2.5, 0.2, 10000, len(resistor_values), labels)
if not len(sys.argv) == 3: if len(sys.argv) != 3:
print 'Usage: {} OUTDIR DURATION'.format(os.path.basename(__file__)) print 'Usage: {} OUTDIR DURATION'.format(os.path.basename(__file__))
sys.exit(1) sys.exit(1)
output_directory = sys.argv[1] output_directory = sys.argv[1]

View File

@ -14,7 +14,7 @@
# #
# pylint: disable=E1101,W0613 # pylint: disable=E1101,W0613,wrong-import-position
from __future__ import division from __future__ import division
import os import os
import sys import sys
@ -30,12 +30,12 @@ from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor, interfaces from twisted.internet import reactor, interfaces
from twisted.internet.error import ConnectionLost, ConnectionDone from twisted.internet.error import ConnectionLost, ConnectionDone
if __name__ == "__main__": # for debugging if __name__ == "__main__": # for debugging
sys.path.append(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from daqpower import log from daqpower import log
from daqpower.config import DeviceConfiguration from daqpower.config import DeviceConfiguration
from daqpower.common import DaqServerRequest, DaqServerResponse, Status from daqpower.common import DaqServerRequest, DaqServerResponse, Status
try: try:
from daqpower.daq import DaqRunner, list_available_devices, CAN_ENUMERATE_DEVICES from daqpower.daq import DaqRunner, list_available_devices, CAN_ENUMERATE_DEVICES
__import_error = None __import_error = None
@ -66,7 +66,7 @@ class DummyDaqRunner(object):
self.is_running = False self.is_running = False
def start(self): def start(self):
import csv, random import csv, random # pylint: disable=multiple-imports
log.info('runner started') log.info('runner started')
for i in xrange(self.config.number_of_ports): for i in xrange(self.config.number_of_ports):
rows = [['power', 'voltage']] + [[random.gauss(1.0, 1.0), random.gauss(1.0, 0.1)] rows = [['power', 'voltage']] + [[random.gauss(1.0, 1.0), random.gauss(1.0, 0.1)]

View File

@ -31,6 +31,7 @@ from wlauto.exceptions import ConfigError, InstrumentError, DeviceError
from wlauto.utils.misc import ensure_directory_exists as _d from wlauto.utils.misc import ensure_directory_exists as _d
from wlauto.utils.types import list_of_ints, list_of_strs, boolean from wlauto.utils.types import list_of_ints, list_of_strs, boolean
# pylint: disable=wrong-import-position,wrong-import-order
daqpower_path = os.path.join(os.path.dirname(__file__), '..', '..', 'external', 'daq_server', 'src') daqpower_path = os.path.join(os.path.dirname(__file__), '..', '..', 'external', 'daq_server', 'src')
sys.path.insert(0, daqpower_path) sys.path.insert(0, daqpower_path)
try: try:
@ -283,7 +284,7 @@ class Daq(Instrument):
self._results = None self._results = None
self._metrics = set() self._metrics = set()
if self.labels: if self.labels:
if not (len(self.labels) == len(self.resistor_values)): # pylint: disable=superfluous-parens if len(self.labels) != len(self.resistor_values):
raise ConfigError('Number of DAQ port labels does not match the number of resistor values.') raise ConfigError('Number of DAQ port labels does not match the number of resistor values.')
else: else:
self.labels = ['PORT_{}'.format(i) for i, _ in enumerate(self.resistor_values)] self.labels = ['PORT_{}'.format(i) for i, _ in enumerate(self.resistor_values)]
@ -319,7 +320,7 @@ class Daq(Instrument):
for name in old_names: for name in old_names:
if name not in self.labels: if name not in self.labels:
raise ConfigError("No channel with label {} specified".format(name)) raise ConfigError("No channel with label {} specified".format(name))
self.label_map = self.merge_channels self.label_map = self.merge_channels # pylint: disable=redefined-variable-type
self.merge_channels = True self.merge_channels = True
else: # Should never reach here else: # Should never reach here
raise AssertionError("Merge files is of invalid type") raise AssertionError("Merge files is of invalid type")

View File

@ -820,7 +820,7 @@ def _adjust_for_thermal(data, filt_method=lambda x: x, thresh=0.9, window=5000,
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys # pylint: disable=wrong-import-position,wrong-import-order
indir, outdir = sys.argv[1], sys.argv[2] indir, outdir = sys.argv[1], sys.argv[2]
device_name = 'odroidxu3' device_name = 'odroidxu3'
big_core = 'a15' big_core = 'a15'

View File

@ -27,6 +27,10 @@ import tempfile
from distutils.version import LooseVersion from distutils.version import LooseVersion
try:
import pandas as pd
except ImportError:
pd = None
from wlauto import Instrument, Parameter, IterationResult from wlauto import Instrument, Parameter, IterationResult
from wlauto.instrumentation import instrument_is_installed from wlauto.instrumentation import instrument_is_installed
@ -34,11 +38,6 @@ from wlauto.exceptions import (InstrumentError, WorkerThreadError, ConfigError,
DeviceNotRespondingError, TimeoutError) DeviceNotRespondingError, TimeoutError)
from wlauto.utils.types import boolean, numeric from wlauto.utils.types import boolean, numeric
try:
import pandas as pd
except ImportError:
pd = None
VSYNC_INTERVAL = 16666667 VSYNC_INTERVAL = 16666667
PAUSE_LATENCY = 20 PAUSE_LATENCY = 20

View File

@ -148,7 +148,7 @@ class PerfInstrument(Instrument):
self.events = [self.events] self.events = [self.events]
if not self.labels: # pylint: disable=E0203 if not self.labels: # pylint: disable=E0203
self.labels = ['perf_{}'.format(i) for i in xrange(len(self.optionstrings))] self.labels = ['perf_{}'.format(i) for i in xrange(len(self.optionstrings))]
if not len(self.labels) == len(self.optionstrings): if len(self.labels) != len(self.optionstrings):
raise ConfigError('The number of labels must match the number of optstrings provided for perf.') raise ConfigError('The number of labels must match the number of optstrings provided for perf.')
def _build_commands(self): def _build_commands(self):
@ -173,4 +173,3 @@ class PerfInstrument(Instrument):
event_string, event_string,
self._get_device_outfile(label)) self._get_device_outfile(label))
return command return command

View File

@ -146,7 +146,7 @@ class CciPmuLogger(Instrument):
raise ConfigError('To use cci_pmu_logger, trace-cmd instrument must also be enabled.') raise ConfigError('To use cci_pmu_logger, trace-cmd instrument must also be enabled.')
if not self.event_labels: # pylint: disable=E0203 if not self.event_labels: # pylint: disable=E0203
self.event_labels = ['event_{}'.format(e) for e in self.events] self.event_labels = ['event_{}'.format(e) for e in self.events]
elif not len(self.events) == len(self.event_labels): elif len(self.events) != len(self.event_labels):
raise ConfigError('cci_pmu_events and cci_pmu_event_labels must be of the same length.') raise ConfigError('cci_pmu_events and cci_pmu_event_labels must be of the same length.')
if len(self.events) > NUMBER_OF_CCI_PMU_COUNTERS: if len(self.events) > NUMBER_OF_CCI_PMU_COUNTERS:
raise ConfigError('The number cci_pmu_counters must be at most {}'.format(NUMBER_OF_CCI_PMU_COUNTERS)) raise ConfigError('The number cci_pmu_counters must be at most {}'.format(NUMBER_OF_CCI_PMU_COUNTERS))

View File

@ -20,15 +20,17 @@ import os
import shutil import shutil
import webbrowser import webbrowser
try:
import jinja2
except ImportError:
jinja2 = None
from wlauto import File, Parameter, ResultProcessor from wlauto import File, Parameter, ResultProcessor
from wlauto.exceptions import ConfigError, ResultProcessorError from wlauto.exceptions import ConfigError, ResultProcessorError
import wlauto.utils.ipython as ipython import wlauto.utils.ipython as ipython
from wlauto.utils.misc import open_file from wlauto.utils.misc import open_file
try:
import jinja2
except ImportError:
jinja2 = None
DEFAULT_NOTEBOOK_TEMPLATE = 'template.ipynb' DEFAULT_NOTEBOOK_TEMPLATE = 'template.ipynb'

View File

@ -51,6 +51,7 @@ workloads:
instrumentation: [fsp] instrumentation: [fsp]
""" """
class MockExtensionLoader(object): class MockExtensionLoader(object):
def __init__(self): def __init__(self):
@ -94,7 +95,7 @@ class NamedMock(object):
self.parameters = [] self.parameters = []
def __getattr__(self, name): def __getattr__(self, name):
if not name in self.__attrs: if name not in self.__attrs:
self.__attrs[name] = NamedMock(name) self.__attrs[name] = NamedMock(name)
return self.__attrs[name] return self.__attrs[name]
@ -164,7 +165,7 @@ class ConfigTest(TestCase):
def test_list_defaults_params(self): def test_list_defaults_params(self):
ws = AgendaWorkloadEntry(id='a', iterations=1, ws = AgendaWorkloadEntry(id='a', iterations=1,
name='defaults_workload', workload_parameters={'param':[3]}) name='defaults_workload', workload_parameters={'param': [3]})
self.config.set_agenda(MockAgenda(ws)) self.config.set_agenda(MockAgenda(ws))
spec = self.config.workload_specs[0] spec = self.config.workload_specs[0]
assert_equal(spec.workload_parameters, {'param': [3]}) assert_equal(spec.workload_parameters, {'param': [3]})

View File

@ -82,8 +82,10 @@ class BadDeviceMeta(DeviceMeta):
basemethods = [getattr(b, vmname) for b in bases if hasattr(b, vmname)] basemethods = [getattr(b, vmname) for b in bases if hasattr(b, vmname)]
methods[vmname] = [bm for bm in basemethods if bm != clsmethod] methods[vmname] = [bm for bm in basemethods if bm != clsmethod]
methods[vmname].append(clsmethod) methods[vmname].append(clsmethod)
def generate_method_wrapper(vname): def generate_method_wrapper(vname):
name__ = vmname name__ = vmname
def wrapper(self, *args, **kwargs): def wrapper(self, *args, **kwargs):
for dm in methods[name__]: for dm in methods[name__]:
dm(self, *args, **kwargs) dm(self, *args, **kwargs)
@ -101,31 +103,31 @@ class BadDevice(Device):
self.exception = exception self.exception = exception
def connect(self): def connect(self):
if 'connect' == self.when_to_fail: if self.when_to_fail == 'connect':
raise self.exception("Connection failure") raise self.exception("Connection failure")
def initialize(self, _): def initialize(self, _):
if 'initialize' == self.when_to_fail: if self.when_to_fail == 'initialize':
raise self.exception("Initialisation failure") raise self.exception("Initialisation failure")
def get_properties(self, _): def get_properties(self, _):
if 'get_properties' == self.when_to_fail: if self.when_to_fail == 'get_properties':
raise self.exception("Failure getting propeties") raise self.exception("Failure getting propeties")
def start(self): def start(self):
if 'start' == self.when_to_fail: if self.when_to_fail == 'start':
raise self.exception("Start failure") raise self.exception("Start failure")
def set_device_parameters(self, **_): def set_device_parameters(self, **_):
if 'set_device_parameters' == self.when_to_fail: if self.when_to_fail == 'set_device_parameters':
raise self.exception("Failure setting parameter") raise self.exception("Failure setting parameter")
def stop(self): def stop(self):
if 'stop' == self.when_to_fail: if self.when_to_fail == 'stop':
raise self.exception("Stop failure") raise self.exception("Stop failure")
def disconnect(self): def disconnect(self):
if 'disconnect' == self.when_to_fail: if self.when_to_fail == 'disconnect':
raise self.exception("Disconnection failure") raise self.exception("Disconnection failure")
def ping(self): def ping(self):
@ -718,14 +720,14 @@ class RunnerTest(TestCase):
expected_signals = [ expected_signals = [
signal.RUN_START.name, signal.RUN_START.name,
signal.RUN_INIT.name, signal.RUN_INIT.name,
signal.WORKLOAD_SPEC_START.name, #Fail Setup signal.WORKLOAD_SPEC_START.name, # Fail Setup
signal.ITERATION_START.name, signal.ITERATION_START.name,
signal.BEFORE_WORKLOAD_SETUP.name, signal.BEFORE_WORKLOAD_SETUP.name,
signal.AFTER_WORKLOAD_SETUP.name, signal.AFTER_WORKLOAD_SETUP.name,
signal.ITERATION_END.name, signal.ITERATION_END.name,
#Skipped iteration #Skipped iteration
signal.WORKLOAD_SPEC_END.name, signal.WORKLOAD_SPEC_END.name,
signal.WORKLOAD_SPEC_START.name, #Fail Run signal.WORKLOAD_SPEC_START.name, # Fail Run
signal.ITERATION_START.name, signal.ITERATION_START.name,
signal.BEFORE_WORKLOAD_SETUP.name, signal.BEFORE_WORKLOAD_SETUP.name,
signal.SUCCESSFUL_WORKLOAD_SETUP.name, signal.SUCCESSFUL_WORKLOAD_SETUP.name,
@ -753,7 +755,7 @@ class RunnerTest(TestCase):
signal.AFTER_WORKLOAD_TEARDOWN.name, signal.AFTER_WORKLOAD_TEARDOWN.name,
signal.ITERATION_END.name, signal.ITERATION_END.name,
signal.WORKLOAD_SPEC_END.name, signal.WORKLOAD_SPEC_END.name,
signal.WORKLOAD_SPEC_START.name, # Fail Result Update signal.WORKLOAD_SPEC_START.name, # Fail Result Update
signal.ITERATION_START.name, signal.ITERATION_START.name,
signal.BEFORE_WORKLOAD_SETUP.name, signal.BEFORE_WORKLOAD_SETUP.name,
signal.SUCCESSFUL_WORKLOAD_SETUP.name, signal.SUCCESSFUL_WORKLOAD_SETUP.name,
@ -781,7 +783,7 @@ class RunnerTest(TestCase):
signal.AFTER_WORKLOAD_TEARDOWN.name, signal.AFTER_WORKLOAD_TEARDOWN.name,
signal.ITERATION_END.name, signal.ITERATION_END.name,
signal.WORKLOAD_SPEC_END.name, signal.WORKLOAD_SPEC_END.name,
signal.WORKLOAD_SPEC_START.name, # Fail Teardown signal.WORKLOAD_SPEC_START.name, # Fail Teardown
signal.ITERATION_START.name, signal.ITERATION_START.name,
signal.BEFORE_WORKLOAD_SETUP.name, signal.BEFORE_WORKLOAD_SETUP.name,
signal.SUCCESSFUL_WORKLOAD_SETUP.name, signal.SUCCESSFUL_WORKLOAD_SETUP.name,
@ -809,7 +811,7 @@ class RunnerTest(TestCase):
signal.AFTER_WORKLOAD_TEARDOWN.name, signal.AFTER_WORKLOAD_TEARDOWN.name,
signal.ITERATION_END.name, signal.ITERATION_END.name,
signal.WORKLOAD_SPEC_END.name, signal.WORKLOAD_SPEC_END.name,
signal.WORKLOAD_SPEC_START.name, #OK signal.WORKLOAD_SPEC_START.name, # OK
signal.ITERATION_START.name, signal.ITERATION_START.name,
signal.BEFORE_WORKLOAD_SETUP.name, signal.BEFORE_WORKLOAD_SETUP.name,
signal.SUCCESSFUL_WORKLOAD_SETUP.name, signal.SUCCESSFUL_WORKLOAD_SETUP.name,
@ -1065,4 +1067,3 @@ class RunnerTest(TestCase):
def _instantiate(cls, *args, **kwargs): def _instantiate(cls, *args, **kwargs):
# Needed to get around Extension's __init__ checks # Needed to get around Extension's __init__ checks
return cls(*args, **kwargs) return cls(*args, **kwargs)

View File

@ -222,11 +222,7 @@ def poll_for_file(device, dfile):
command = "adb " + device_string + " shell \" if [ -f " + dfile + " ] ; then true ; else false ; fi\" " command = "adb " + device_string + " shell \" if [ -f " + dfile + " ] ; then true ; else false ; fi\" "
logger.debug(command) logger.debug(command)
result = subprocess.call(command, stderr=subprocess.PIPE, shell=True) result = subprocess.call(command, stderr=subprocess.PIPE, shell=True)
if not result: return not bool(result)
return True
else:
return False
am_start_error = re.compile(r"Error: Activity class {[\w|.|/]*} does not exist") am_start_error = re.compile(r"Error: Activity class {[\w|.|/]*} does not exist")

View File

@ -18,6 +18,7 @@ import os
import subprocess import subprocess
from distutils.version import StrictVersion from distutils.version import StrictVersion
# pylint: disable=wrong-import-position
import_error_str = '' import_error_str = ''
try: try:
import IPython import IPython
@ -28,7 +29,7 @@ except ImportError as import_error:
if import_error.message.startswith("No module named"): # pylint: disable=E1101 if import_error.message.startswith("No module named"): # pylint: disable=E1101
import_error_str = 'ipynb_exporter requires ipython package to be installed' import_error_str = 'ipynb_exporter requires ipython package to be installed'
else: else:
import_error_str = import_error.message import_error_str = import_error.message # pylint: disable=redefined-variable-type
# The current code generates notebooks version 3 # The current code generates notebooks version 3
NBFORMAT_VERSION = 3 NBFORMAT_VERSION = 3

View File

@ -250,7 +250,7 @@ def get_traceback(exc=None):
def merge_dicts(*args, **kwargs): def merge_dicts(*args, **kwargs):
if not len(args) >= 2: if len(args) < 2:
raise ValueError('Must specify at least two dicts to merge.') raise ValueError('Must specify at least two dicts to merge.')
func = partial(_merge_two_dicts, **kwargs) func = partial(_merge_two_dicts, **kwargs)
return reduce(func, args) return reduce(func, args)
@ -314,7 +314,7 @@ def _merge_two_dicts(base, other, list_duplicates='all', match_types=False, # p
def merge_lists(*args, **kwargs): def merge_lists(*args, **kwargs):
if not len(args) >= 2: if len(args) < 2:
raise ValueError('Must specify at least two lists to merge.') raise ValueError('Must specify at least two lists to merge.')
func = partial(_merge_two_lists, **kwargs) func = partial(_merge_two_lists, **kwargs)
return reduce(func, args) return reduce(func, args)
@ -696,7 +696,7 @@ def load_struct_from_python(filepath=None, text=None):
for k, v in mod.__dict__.iteritems() for k, v in mod.__dict__.iteritems()
if not k.startswith('_')) if not k.startswith('_'))
except SyntaxError as e: except SyntaxError as e:
raise LoadSyntaxError(e.message, e.filepath, e.lineno) raise LoadSyntaxError(e.message, filepath, e.lineno)
def load_struct_from_yaml(filepath=None, text=None): def load_struct_from_yaml(filepath=None, text=None):
@ -713,7 +713,7 @@ def load_struct_from_yaml(filepath=None, text=None):
except yaml.YAMLError as e: except yaml.YAMLError as e:
lineno = None lineno = None
if hasattr(e, 'problem_mark'): if hasattr(e, 'problem_mark'):
lineno = e.problem_mark.line lineno = e.problem_mark.line # pylint: disable=no-member
raise LoadSyntaxError(e.message, filepath=filepath, lineno=lineno) raise LoadSyntaxError(e.message, filepath=filepath, lineno=lineno)

View File

@ -51,7 +51,7 @@ class KshellConnection(object):
def login(self, user, password): def login(self, user, password):
code, out = self.send_command('login {} {}\r\n'.format(user, password)) code, out = self.send_command('login {} {}\r\n'.format(user, password))
if not code == 250: if code != 250:
raise NetioError('Login failed. Got: {} {}'.format(code, out)) raise NetioError('Login failed. Got: {} {}'.format(code, out))
def enable_port(self, port): def enable_port(self, port):
@ -64,7 +64,7 @@ class KshellConnection(object):
def set_port(self, port, value): def set_port(self, port, value):
code, out = self.send_command('port {} {}'.format(port, value)) code, out = self.send_command('port {} {}'.format(port, value))
if not code == 250: if code != 250:
raise NetioError('Could not set {} on port {}. Got: {} {}'.format(value, port, code, out)) raise NetioError('Could not set {} on port {}. Got: {} {}'.format(value, port, code, out))
def send_command(self, command): def send_command(self, command):
@ -95,4 +95,3 @@ class KshellConnection(object):
def close(self): def close(self):
self.conn.close() self.conn.close()

View File

@ -19,6 +19,8 @@ from contextlib import contextmanager
from distutils.version import StrictVersion as V from distutils.version import StrictVersion as V
import serial import serial
# pylint: disable=ungrouped-imports
import pexpect import pexpect
if V(pexpect.__version__) < V('4.0.0'): if V(pexpect.__version__) < V('4.0.0'):
import fdpexpect # pylint: disable=import-error import fdpexpect # pylint: disable=import-error
@ -118,5 +120,3 @@ def open_serial_connection(timeout, get_conn=False, init_dtr=None, *args, **kwar
target.close() # Closes the file descriptor used by the conn. target.close() # Closes the file descriptor used by the conn.
del conn del conn

View File

@ -43,7 +43,7 @@ def ssh_get_shell(host, username, password=None, keyfile=None, port=None, timeou
raise ConfigError('keyfile may not be used with a telnet connection.') raise ConfigError('keyfile may not be used with a telnet connection.')
conn = TelnetConnection() conn = TelnetConnection()
else: # ssh else: # ssh
conn = pxssh.pxssh() conn = pxssh.pxssh() # pylint: disable=redefined-variable-type
try: try:
if keyfile: if keyfile:
conn.login(host, username, ssh_key=keyfile, port=port, login_timeout=timeout) conn.login(host, username, ssh_key=keyfile, port=port, login_timeout=timeout)
@ -274,4 +274,3 @@ def process_backspaces(text):
else: else:
chars.append(c) chars.append(c)
return ''.join(chars) return ''.join(chars)

View File

@ -79,7 +79,7 @@ class Antutu(AndroidUiAutoBenchmark):
if self.version == '4.0.3': if self.version == '4.0.3':
metrics = extract_version4_metrics(fh) metrics = extract_version4_metrics(fh)
else: else:
metrics = extract_older_version_metrics(fh) metrics = extract_older_version_metrics(fh) # pylint: disable=redefined-variable-type
for key, value in metrics.iteritems(): for key, value in metrics.iteritems():
key = key.replace(' ', '_') key = key.replace(' ', '_')
context.result.add_metric(key, value) context.result.add_metric(key, value)
@ -118,7 +118,7 @@ def extract_older_version_metrics(fh):
for line in fh: for line in fh:
if 'i/antutu' in line.lower(): if 'i/antutu' in line.lower():
parts = line.split(':') parts = line.split(':')
if not len(parts) == 3: if len(parts) != 3:
continue continue
metric = parts[1].strip() metric = parts[1].strip()
value = int(parts[2].strip()) value = int(parts[2].strip())
@ -132,4 +132,3 @@ def extract_older_version_metrics(fh):
metrics[metric] = value metrics[metric] = value
return metrics return metrics

View File

@ -14,11 +14,11 @@
# pylint: disable=W0201, C0103 # pylint: disable=W0201, C0103
from wlauto import Workload, Parameter, Executable
import os import os
import re import re
from wlauto import Workload, Parameter, Executable
results_txt = 'ebizzy_results.txt' results_txt = 'ebizzy_results.txt'
record_regex = re.compile(r'(?P<record>\d+) records/s') record_regex = re.compile(r'(?P<record>\d+) records/s')
result_regex = re.compile(r'(?P<metric>\D+)(?P<value>\d+.*\b)(?P<unit>\S+)') result_regex = re.compile(r'(?P<metric>\D+)(?P<value>\d+.*\b)(?P<unit>\S+)')

View File

@ -14,11 +14,12 @@
# pylint: disable=W0201, C0103 # pylint: disable=W0201, C0103
from wlauto import Workload, Parameter, Executable
import os import os
import re import re
from wlauto import Workload, Parameter, Executable
hackbench_results_txt = 'hackbench_results.txt' hackbench_results_txt = 'hackbench_results.txt'
regex_map = {"total_groups": (re.compile(r'(\d+) groups'), "groups"), regex_map = {"total_groups": (re.compile(r'(\d+) groups'), "groups"),

View File

@ -44,7 +44,7 @@ class IdleWorkload(Workload):
def setup(self, context): def setup(self, context):
if self.stop_android: if self.stop_android:
if not self.device.platform == 'android': if self.device.platform != 'android':
raise ConfigError('stop_android can only be set for Android devices') raise ConfigError('stop_android can only be set for Android devices')
if not self.device.is_rooted: if not self.device.is_rooted:
raise WorkloadError('Idle workload requires the device to be rooted in order to stop Android.') raise WorkloadError('Idle workload requires the device to be rooted in order to stop Android.')
@ -66,4 +66,3 @@ class IdleWorkload(Workload):
time.sleep(0.2) time.sleep(0.2)
while self.device.execute('getprop init.svc.bootanim').strip() == 'running': while self.device.execute('getprop init.svc.bootanim').strip() == 'running':
time.sleep(1) time.sleep(1)

View File

@ -12,16 +12,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init
from wlauto import Workload, Parameter, Executable
from wlauto.exceptions import ConfigError
from wlauto.utils.types import list_of_ints
from collections import OrderedDict from collections import OrderedDict
from itertools import izip_longest from itertools import izip_longest
import os import os
import re import re
import csv import csv
from wlauto import Workload, Parameter, Executable
from wlauto.exceptions import ConfigError
from wlauto.utils.types import list_of_ints
iozone_results_txt = 'iozone_results.txt' iozone_results_txt = 'iozone_results.txt'

View File

@ -119,10 +119,7 @@ class Spec2000(Workload):
# (also more than just summary/non-summary classification?) # (also more than just summary/non-summary classification?)
class _SPECSummaryMetrics(object): class _SPECSummaryMetrics(object):
def __contains__(self, item): def __contains__(self, item):
if item.endswith('_real'): return item.endswith('_real')
return True
else:
return False
asset_file = 'spec2000-assets.tar.gz' asset_file = 'spec2000-assets.tar.gz'
@ -351,4 +348,3 @@ class CommandSpec(object):
self.datadir = None self.datadir = None
self.command = None self.command = None
self.threads = None self.threads = None

View File

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init
import os
import re
from wlauto import Workload, Parameter, Executable from wlauto import Workload, Parameter, Executable
import os
import re
stream_results_txt = 'stream_results.txt' stream_results_txt = 'stream_results.txt'
system_array_regex = re.compile(r'^This system uses (\d)') system_array_regex = re.compile(r'^This system uses (\d)')

View File

@ -300,8 +300,7 @@ def parse_telemetry_results(filepath):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys # pylint: disable=wrong-import-order,wrong-import-position
from pprint import pprint from pprint import pprint # pylint: disable=wrong-import-order,wrong-import-position
path = sys.argv[1] path = sys.argv[1]
pprint(parse_telemetry_results(path)) pprint(parse_telemetry_results(path))