From 6afd710bd117c36bad2e5d0ae6e522d8238274b9 Mon Sep 17 00:00:00 2001
From: Marc Bonnici <marc.bonnici@arm.com>
Date: Tue, 3 Jul 2018 14:25:33 +0100
Subject: [PATCH] wa/instruments: pylint/fixes

---
 wa/instruments/dmesg.py              |  2 +-
 wa/instruments/energy_measurement.py | 10 +++++-----
 wa/instruments/fps.py                |  5 +++--
 wa/instruments/hwmon.py              | 10 +++++-----
 wa/instruments/misc.py               |  5 +----
 wa/instruments/screencap.py          |  4 ++--
 wa/instruments/serialmon.py          |  2 +-
 7 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/wa/instruments/dmesg.py b/wa/instruments/dmesg.py
index b4b5f069..2c621da5 100644
--- a/wa/instruments/dmesg.py
+++ b/wa/instruments/dmesg.py
@@ -38,7 +38,7 @@ class DmesgInstrument(Instrument):
 
     loglevel_file = '/proc/sys/kernel/printk'
 
-    def initialize(self, context):
+    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')
diff --git a/wa/instruments/energy_measurement.py b/wa/instruments/energy_measurement.py
index 98ea30dd..365e2a6d 100644
--- a/wa/instruments/energy_measurement.py
+++ b/wa/instruments/energy_measurement.py
@@ -20,7 +20,6 @@ from collections import defaultdict
 import os
 import shutil
 
-from wa.utils.types import list_of_numbers
 
 from devlib import DerivedEnergyMeasurements
 from devlib.instrument import CONTINUOUS
@@ -36,7 +35,8 @@ from wa import Instrument, Parameter
 from wa.framework import pluginloader
 from wa.framework.plugin import Plugin
 from wa.framework.exception import ConfigError, InstrumentError
-from wa.utils.types import list_of_strings, list_of_ints, list_or_string, obj_dict, identifier
+from wa.utils.types import (list_of_strings, list_of_ints, list_or_string,
+                            obj_dict, identifier, list_of_numbers)
 
 
 class EnergyInstrumentBackend(Plugin):
@@ -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)}
+        return {None: self.instrument(target, **kwargs)} #pylint: disable=not-callable
 
 
 class DAQBackend(EnergyInstrumentBackend):
@@ -284,6 +284,7 @@ class AcmeCapeBackend(EnergyInstrumentBackend):
                   """),
     ]
 
+    #pylint: disable=arguments-differ
     def get_instruments(self, target, metadir,
                         iio_capture, host, iio_devices, buffer_size):
 
@@ -428,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):
+            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()
@@ -506,4 +507,3 @@ class EnergyMeasurement(Instrument):
                 units = metrics[0].units
                 value = sum(m.value for m in metrics)
                 context.add_metric(name, value, units)
-
diff --git a/wa/instruments/fps.py b/wa/instruments/fps.py
index a999be6c..47bddf49 100644
--- a/wa/instruments/fps.py
+++ b/wa/instruments/fps.py
@@ -119,6 +119,7 @@ class FpsInstrument(Instrument):
             return
 
         self._is_enabled = True
+        #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')
@@ -127,12 +128,12 @@ class FpsInstrument(Instrument):
             self.processor = DerivedSurfaceFlingerStats(self.drop_threshold, filename='fps.csv')
         self.collector.reset()
 
-    def start(self, context):
+    def start(self, context): #pylint: disable=unused-argument
         if not self._is_enabled:
             return
         self.collector.start()
 
-    def stop(self, context):
+    def stop(self, context): #pylint: disable=unused-argument
         if not self._is_enabled:
             return
         self.collector.stop()
diff --git a/wa/instruments/hwmon.py b/wa/instruments/hwmon.py
index 1cc2d4bc..cb1321c6 100644
--- a/wa/instruments/hwmon.py
+++ b/wa/instruments/hwmon.py
@@ -41,18 +41,18 @@ class HwmonInstrument(Instrument):
     hwmon data will be reported.
     """
 
-    def initialize(self, context):
+    def initialize(self, context): #pylint: disable=unused-argument
         self.instrument = _Instrument(self.target)
 
-    def setup(self, context):
+    def setup(self, context): #pylint: disable=unused-argument
         self.instrument.reset()
 
     @fast
-    def start(self, context):
+    def start(self, context): #pylint: disable=unused-argument
         self.before = self.instrument.take_measurement()
 
     @fast
-    def stop(self, context):
+    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):
+    def teardown(self, context): #pylint: disable=unused-argument
         self.instrument.teardown()
diff --git a/wa/instruments/misc.py b/wa/instruments/misc.py
index c8e64848..62417941 100644
--- a/wa/instruments/misc.py
+++ b/wa/instruments/misc.py
@@ -26,14 +26,11 @@ Some "standard" instruments to collect additional info about workload execution.
           precise data about specific operations.
 """
 import os
-import re
 import logging
 import time
 import tarfile
 from subprocess import CalledProcessError
 
-from future.moves.itertools import zip_longest
-
 from devlib.exception import TargetError
 from devlib.utils.android import ApkInfo
 
@@ -41,7 +38,7 @@ from wa import Instrument, Parameter, very_fast
 from wa.framework.exception import ConfigError
 from wa.framework.instrument import slow
 from wa.utils.diff import diff_sysfs_dirs, diff_interrupt_files
-from wa.utils.misc import as_relative, diff_tokens, write_table
+from wa.utils.misc import as_relative
 from wa.utils.misc import ensure_file_directory_exists as _f
 from wa.utils.misc import ensure_directory_exists as _d
 from wa.utils.types import list_of_strings
diff --git a/wa/instruments/screencap.py b/wa/instruments/screencap.py
index 67113af6..ef7cbf8c 100644
--- a/wa/instruments/screencap.py
+++ b/wa/instruments/screencap.py
@@ -50,8 +50,8 @@ class ScreenCaptureInstrument(Instrument):
                                                 output_path,
                                                 self.period)
 
-    def start(self, context):
+    def start(self, context): #pylint: disable=unused-argument
         self.collector.start()
 
-    def stop(self, context):
+    def stop(self, context): #pylint: disable=unused-argument
         self.collector.stop()
diff --git a/wa/instruments/serialmon.py b/wa/instruments/serialmon.py
index 292fba9c..d709e7d1 100644
--- a/wa/instruments/serialmon.py
+++ b/wa/instruments/serialmon.py
@@ -17,7 +17,7 @@ import os
 
 from devlib import SerialTraceCollector
 
-from wa import Instrument, Parameter, InstrumentError, hostside
+from wa import Instrument, Parameter, hostside
 
 
 class SerialMon(Instrument):