diff --git a/wa/utils/android.py b/wa/utils/android.py index 3e016dd4..b52b1559 100644 --- a/wa/utils/android.py +++ b/wa/utils/android.py @@ -57,7 +57,7 @@ class LogcatParser(object): if event: yield event - def parse_line(self, line): + 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 diff --git a/wa/utils/cpustates.py b/wa/utils/cpustates.py index 71f53b2f..2de3b471 100755 --- a/wa/utils/cpustates.py +++ b/wa/utils/cpustates.py @@ -564,7 +564,7 @@ class CpuUtilizationTimeline(object): def update(self, timestamp, core_states): # NOQA row = [timestamp] - for core, [idle_state, frequency] in enumerate(core_states): + for core, [_, frequency] in enumerate(core_states): if frequency is not None: frequency /= float(self._max_freq_list[core]) row.append(frequency) @@ -584,7 +584,7 @@ def build_idle_state_map(cpus): for cpu_idx, cpu in enumerate(cpus): related_cpus = set(cpu.cpufreq.related_cpus) - set([cpu_idx]) first_cluster_state = cpu.cpuidle.num_states - 1 - for state_idx, state in enumerate(cpu.cpuidle.states): + for state_idx, _ in enumerate(cpu.cpuidle.states): if state_idx < first_cluster_state: idle_state_map[(cpu_idx, state_idx)] = [] else: diff --git a/wa/utils/diff.py b/wa/utils/diff.py index 5f126358..d57359c8 100644 --- a/wa/utils/diff.py +++ b/wa/utils/diff.py @@ -17,8 +17,8 @@ import os import re import logging -#pyline disable=redefined-builtin -from builtins import zip + +from builtins import zip #pyline disable=redefined-builtin from future.moves.itertools import zip_longest from wa.utils.misc import diff_tokens, write_table @@ -70,7 +70,7 @@ def diff_interrupt_files(before, after, result): # pylint: disable=R0914 def diff_sysfs_dirs(before, after, result): # pylint: disable=R0914 before_files = [] - for root, dirs, files in os.walk(before): + for root, _, files in os.walk(before): before_files.extend([os.path.join(root, f) for f in files]) before_files = list(filter(os.path.isfile, before_files)) files = [os.path.relpath(f, before) for f in before_files] diff --git a/wa/utils/log.py b/wa/utils/log.py index 243bff20..df15d090 100644 --- a/wa/utils/log.py +++ b/wa/utils/log.py @@ -49,7 +49,7 @@ _indent_width = 4 _console_handler = None _init_handler = None - +#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,6 +95,7 @@ def set_level(level): _console_handler.setLevel(level) +#pylint: disable=global-statement def add_file(filepath, level=logging.DEBUG, fmt='%(asctime)s %(levelname)-8s %(name)10.10s: %(message)s'): global _init_handler @@ -139,11 +140,13 @@ def __disable_logger(logger): logger.propagate = False +#pylint: disable=global-statement def indent(): global _indent_level _indent_level += 1 +#pylint: disable=global-statement def dedent(): global _indent_level _indent_level -= 1 @@ -158,6 +161,7 @@ def indentcontext(): dedent() +#pylint: disable=global-statement def set_indent_level(level): global _indent_level old_level = _indent_level @@ -265,11 +269,11 @@ class LineFormatter(logging.Formatter): record.asctime = self.formatTime(record, self.datefmt) indent_level = getattr(record, 'indent_level', _indent_level) - indent = _indent_width * indent_level + cur_indent = _indent_width * indent_level d = record.__dict__ parts = [] for line in record.message.split('\n'): - line = ' ' * indent + line + line = ' ' * cur_indent + line d.update({'message': line.strip('\r')}) parts.append(self._fmt % d) diff --git a/wa/utils/misc.py b/wa/utils/misc.py index 6a70aee5..8916d077 100644 --- a/wa/utils/misc.py +++ b/wa/utils/misc.py @@ -418,7 +418,7 @@ def categorize(v): else: return 'c' - +#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 diff --git a/wa/utils/serializer.py b/wa/utils/serializer.py index b8930e37..2e39ebf3 100644 --- a/wa/utils/serializer.py +++ b/wa/utils/serializer.py @@ -65,6 +65,7 @@ from datetime import datetime import yaml as _yaml import dateutil.parser +#pylint: disable=redefined-builtin from past.builtins import basestring from wa.framework.exception import SerializerSyntaxError @@ -274,7 +275,7 @@ class python(object): exec(s, pod) # pylint: disable=exec-used except SyntaxError as e: raise SerializerSyntaxError(e.message, e.lineno) - for k in list(pod.keys()): + for k in list(pod.keys()): # pylint: disable=consider-iterating-dictionary if k.startswith('__'): del pod[k] return pod @@ -350,7 +351,7 @@ def _write_pod(pod, wfh, fmt=None): def is_pod(obj): - if type(obj) not in POD_TYPES: + if type(obj) not in POD_TYPES: #pylint: disable=unidiomatic-typecheck return False if hasattr(obj, 'items'): for k, v in obj.items(): @@ -361,6 +362,3 @@ def is_pod(obj): if not is_pod(v): return False return True - - - diff --git a/wa/utils/terminalsize.py b/wa/utils/terminalsize.py index 530f59c8..6381653a 100644 --- a/wa/utils/terminalsize.py +++ b/wa/utils/terminalsize.py @@ -105,4 +105,3 @@ def _get_terminal_size_linux(): if __name__ == "__main__": sizex, sizey = get_terminal_size() print('width =', sizex, 'height =', sizey) - diff --git a/wa/utils/trace_cmd.py b/wa/utils/trace_cmd.py index 24a1cbfd..978cde1e 100644 --- a/wa/utils/trace_cmd.py +++ b/wa/utils/trace_cmd.py @@ -266,6 +266,7 @@ class TraceCmdParser(object): by trace-cmd """ inside_maked_region = False + #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: diff --git a/wa/utils/types.py b/wa/utils/types.py index 823cf0f4..318e6a1c 100644 --- a/wa/utils/types.py +++ b/wa/utils/types.py @@ -800,7 +800,7 @@ class cpu_mask(object): elif isinstance(cpus, list): self._mask = list_to_mask(cpus) elif isinstance(cpus, cpu_mask): - self._mask = cpus._mask + self._mask = cpus._mask # pylint: disable=protected-access else: msg = 'Unknown conversion from {} to cpu mask' raise ValueError(msg.format(cpus))