factory: Fix arguments-differ pylint error
Make the argument names the same with the overridden method's if those
names are suitable to the context of the function body.
BUG=chromium:999876
TEST=make lint
Change-Id: I5bde2554e9e047a3514783d96dfb9722dc49f745
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/1991294
Commit-Queue: Yilin Yang (kerker) <kerker@chromium.org>
Tested-by: Yilin Yang (kerker) <kerker@chromium.org>
Auto-Submit: Yilin Yang (kerker) <kerker@chromium.org>
Reviewed-by: Yong Hong <yhong@chromium.org>
diff --git a/py/device/chromeos/camera.py b/py/device/chromeos/camera.py
index f4f13f8..95520b4 100644
--- a/py/device/chromeos/camera.py
+++ b/py/device/chromeos/camera.py
@@ -97,6 +97,7 @@
raise CameraError('No %s camera is found' % facing)
return self._index_mapping[facing]
+ # pylint: disable=arguments-differ
def GetCameraDevice(self, facing):
"""Get the camera device of the given direction the camera faces.
diff --git a/py/hwid/service/appengine/hwid_manager.py b/py/hwid/service/appengine/hwid_manager.py
index 7ba61d0..d1d3324 100644
--- a/py/hwid/service/appengine/hwid_manager.py
+++ b/py/hwid/service/appengine/hwid_manager.py
@@ -1033,9 +1033,9 @@
"""Seeds the object from a yaml string of hwid definitions."""
return self._SeedFromData(raw_hwid_yaml)
- def _SeedFromData(self, raw_hwid_data):
+ def _SeedFromData(self, hwid_data):
self.database = database.Database.LoadData(
- raw_hwid_data, expected_checksum=None)
+ hwid_data, expected_checksum=None)
def GetBomAndConfigless(self, hwid_string):
"""Get the BOM and configless field for a given HWID.
diff --git a/py/instalog/datatypes_unittest.py b/py/instalog/datatypes_unittest.py
index 05d35b9..d3f3a33 100755
--- a/py/instalog/datatypes_unittest.py
+++ b/py/instalog/datatypes_unittest.py
@@ -66,7 +66,7 @@
"""Implements a fake PluginAPI.
Implements IsFlushing, EventStreamNext, EventStreamCommit, and
- EventStreamAbort from PluginAPI. Ignores the `plugin` and `event_stream`
+ EventStreamAbort from PluginAPI. Ignores the `plugin` and `plugin_stream`
arguments, essentially acting as a BufferEventStream itself.
"""
@@ -86,8 +86,8 @@
del plugin
return False
- def EventStreamNext(self, plugin, event_stream, timeout=1):
- del plugin, event_stream, timeout
+ def EventStreamNext(self, plugin, plugin_stream, timeout=1):
+ del plugin, plugin_stream, timeout
if self._expired:
raise plugin_base.EventStreamExpired
if self._buffer_queue.empty():
@@ -97,8 +97,8 @@
logging.debug('Popping %s...', ret)
return ret
- def EventStreamCommit(self, plugin, event_stream):
- del plugin, event_stream
+ def EventStreamCommit(self, plugin, plugin_stream):
+ del plugin, plugin_stream
if self._expired:
raise plugin_base.EventStreamExpired
self._expired = True
@@ -106,8 +106,8 @@
return False
return True
- def EventStreamAbort(self, plugin, event_stream):
- del plugin, event_stream
+ def EventStreamAbort(self, plugin, plugin_stream):
+ del plugin, plugin_stream
if self._expired:
raise plugin_base.EventStreamExpired
self._expired = True
diff --git a/py/instalog/json_utils.py b/py/instalog/json_utils.py
index 9aa9efe..c8682a4 100644
--- a/py/instalog/json_utils.py
+++ b/py/instalog/json_utils.py
@@ -58,7 +58,7 @@
class JSONEncoder(json.JSONEncoder):
- def default(self, obj): # pylint: disable=method-hidden
+ def default(self, obj): # pylint: disable=method-hidden, arguments-differ
"""Handler for serializing objects during conversion to JSON.
Outputs datetime, date, and time objects with enough metadata to restore
diff --git a/py/instalog/plugins/buffer_priority_file.py b/py/instalog/plugins/buffer_priority_file.py
index 5198f07..e12dcb7 100755
--- a/py/instalog/plugins/buffer_priority_file.py
+++ b/py/instalog/plugins/buffer_priority_file.py
@@ -303,18 +303,18 @@
if file_num is not None:
self._file_num_lock[file_num].CheckAndRelease()
- def AddConsumer(self, name):
+ def AddConsumer(self, consumer_id):
"""See BufferPlugin.AddConsumer."""
- self.consumers[name] = Consumer(name, self)
+ self.consumers[consumer_id] = Consumer(consumer_id, self)
for pri_level in xrange(_PRIORITY_LEVEL):
for file_num in xrange(_PARTITION):
- self.buffer_file[pri_level][file_num].AddConsumer(name)
+ self.buffer_file[pri_level][file_num].AddConsumer(consumer_id)
- def RemoveConsumer(self, name):
+ def RemoveConsumer(self, consumer_id):
"""See BufferPlugin.RemoveConsumer."""
for pri_level in xrange(_PRIORITY_LEVEL):
for file_num in xrange(_PARTITION):
- self.buffer_file[pri_level][file_num].RemoveConsumer(name)
+ self.buffer_file[pri_level][file_num].RemoveConsumer(consumer_id)
def ListConsumers(self, details=0):
"""See BufferPlugin.ListConsumers."""
@@ -341,9 +341,9 @@
consumers_dict[name] = progress_dict[name]
return consumers_dict
- def Consume(self, name):
+ def Consume(self, consumer_id):
"""See BufferPlugin.Consume."""
- return self.consumers[name].CreateStream()
+ return self.consumers[consumer_id].CreateStream()
class Consumer(log_utils.LoggerMixin, plugin_base.BufferEventStream):
diff --git a/py/instalog/plugins/buffer_simple_file.py b/py/instalog/plugins/buffer_simple_file.py
index d2ca5f8..9ea8e63 100755
--- a/py/instalog/plugins/buffer_simple_file.py
+++ b/py/instalog/plugins/buffer_simple_file.py
@@ -117,22 +117,22 @@
self.exception('Exception encountered when producing events')
return False
- def AddConsumer(self, name):
+ def AddConsumer(self, consumer_id):
"""See BufferPlugin.AddConsumer."""
- self.buffer_file.AddConsumer(name)
+ self.buffer_file.AddConsumer(consumer_id)
- def RemoveConsumer(self, name):
+ def RemoveConsumer(self, consumer_id):
"""See BufferPlugin.RemoveConsumer."""
- self.buffer_file.RemoveConsumer(name)
+ self.buffer_file.RemoveConsumer(consumer_id)
def ListConsumers(self, details=0):
"""See BufferPlugin.ListConsumers."""
del details
return self.buffer_file.ListConsumers()
- def Consume(self, name):
+ def Consume(self, consumer_id):
"""See BufferPlugin.Consume."""
- return self.buffer_file.Consume(name)
+ return self.buffer_file.Consume(consumer_id)
if __name__ == '__main__':
diff --git a/py/instalog/plugins/input_http.py b/py/instalog/plugins/input_http.py
index c538ab3..85406c6 100755
--- a/py/instalog/plugins/input_http.py
+++ b/py/instalog/plugins/input_http.py
@@ -82,7 +82,7 @@
else:
self.read_lines_to_eof()
- def make_file(self, binary=None):
+ def make_file(self):
"""Always use memory.
When the content is larger than 1k, FieldStorage will call make_file to
@@ -90,7 +90,6 @@
in-memory buffer. Note there will still be one copy in __write, but
there won't be system calls for creating or deleting files (and no fd used).
"""
- del binary # Unused.
if not self.name or self.name == 'event':
return StringIO.StringIO()
diff --git a/py/test/fixture/arduino.py b/py/test/fixture/arduino.py
index c23a9e5..85018a5 100755
--- a/py/test/fixture/arduino.py
+++ b/py/test/fixture/arduino.py
@@ -73,6 +73,7 @@
def __del__(self):
self.Disconnect()
+ # pylint: disable=arguments-differ
def Connect(self, **kwargs):
"""Opens a serial connection.
diff --git a/py/test/fixture/dummy_bft_fixture.py b/py/test/fixture/dummy_bft_fixture.py
index f2c893b..75ec640 100644
--- a/py/test/fixture/dummy_bft_fixture.py
+++ b/py/test/fixture/dummy_bft_fixture.py
@@ -22,6 +22,7 @@
# fixture's action.
_delay_secs = 3
+ # pylint: disable=arguments-differ
def GetSystemStatus(self, probe):
del probe # Unused.
return bft_fixture.BFTFixture.Status.ON
diff --git a/py/test/fixture/spring_bft_fixture.py b/py/test/fixture/spring_bft_fixture.py
index 1310a13..beada6b 100644
--- a/py/test/fixture/spring_bft_fixture.py
+++ b/py/test/fixture/spring_bft_fixture.py
@@ -77,6 +77,7 @@
# Fixture ID. Obtained from Init().
fixture_id = 0
+ # pylint: disable=arguments-differ
def GetSystemStatus(self, probe):
"""Reads internal status of a testing board.
diff --git a/py/test/utils/camera_utils.py b/py/test/utils/camera_utils.py
index 6c15ae7..3746cbc 100644
--- a/py/test/utils/camera_utils.py
+++ b/py/test/utils/camera_utils.py
@@ -283,6 +283,7 @@
os.path.join(os.path.dirname(__file__), *paths))
self._enabled = False
+ # pylint: disable=arguments-differ
def EnableCamera(self):
self._enabled = True
diff --git a/py/tools/ovl.py b/py/tools/ovl.py
index b0e8335..8bc40a1 100755
--- a/py/tools/ovl.py
+++ b/py/tools/ovl.py
@@ -562,9 +562,9 @@
termios.tcsetattr(self._stdin_fd, termios.TCSANOW, self._old_termios)
print('Connection to %s closed.' % self._mid)
- def received_message(self, msg):
- if msg.is_binary:
- sys.stdout.write(msg.data)
+ def received_message(self, message):
+ if message.is_binary:
+ sys.stdout.write(message.data)
sys.stdout.flush()
@@ -601,9 +601,9 @@
def closed(self, code, reason=None):
pass
- def received_message(self, msg):
- if msg.is_binary:
- self.output.write(msg.data)
+ def received_message(self, message):
+ if message.is_binary:
+ self.output.write(message.data)
self.output.flush()
@@ -644,9 +644,9 @@
self._stop.set()
sys.exit(0)
- def received_message(self, msg):
- if msg.is_binary:
- self._sock.send(msg.data)
+ def received_message(self, message):
+ if message.is_binary:
+ self._sock.send(message.data)
def Arg(*args, **kwargs):
diff --git a/py/umpire/server/service/umpire_service.py b/py/umpire/server/service/umpire_service.py
index 169666e..cc6bbdc 100644
--- a/py/umpire/server/service/umpire_service.py
+++ b/py/umpire/server/service/umpire_service.py
@@ -260,14 +260,14 @@
self._Info('%r' % s)
# Twisted process protocol callbacks.
- def makeConnection(self, process):
- self._Debug('makeConnection %s' % process)
- self.subprocess = process
+ def makeConnection(self, transport):
+ self._Debug('makeConnection %s' % transport)
+ self.subprocess = transport
def Started():
self._ChangeState(State.STARTED)
self.deferred_start.callback(self.subprocess.pid)
self.start_monitor = reactor.callLater(_STARTTIME_LIMIT, Started)
- return protocol.ProcessProtocol.makeConnection(self, process)
+ return protocol.ProcessProtocol.makeConnection(self, transport)
def connectionMade(self):
"""On process start."""
@@ -299,9 +299,9 @@
"""On stderr close."""
self._Debug('stderr lost')
- def processEnded(self, status):
+ def processEnded(self, reason):
"""Subprocess has been ended."""
- del status # Unused.
+ del reason # Unused.
self.subprocess = None
self.CancelAllMonitors()
@@ -431,12 +431,12 @@
if '_unittest' in self.modulename or 'test_' in self.modulename:
self.name = self.classname
- def CreateProcesses(self, dummy_config, dummy_env):
+ def CreateProcesses(self, umpire_config, env):
"""Creates list of processes via config.
Params:
- dummy_config: Umpire config dict.
- dummy_env: UmpireEnv.
+ umpire_config: Umpire config dict.
+ env: UmpireEnv.
Returns:
A list of ServiceProcess.
diff --git a/py/umpire/server/web/xmlrpc.py b/py/umpire/server/web/xmlrpc.py
index 22d90cb..901fbcd 100644
--- a/py/umpire/server/web/xmlrpc.py
+++ b/py/umpire/server/web/xmlrpc.py
@@ -37,6 +37,7 @@
"""
return list(self.handlers)
+ # pylint: disable=arguments-differ
def lookupProcedure(self, procedure_path):
"""Searches RPC procedure by name.
diff --git a/py/utils/process_utils.py b/py/utils/process_utils.py
index 90144d3..fa7f514 100644
--- a/py/utils/process_utils.py
+++ b/py/utils/process_utils.py
@@ -161,6 +161,7 @@
"""
return GetLines(self.stderr_data, strip)
+ # pylint: disable=arguments-differ
def communicate(self, *args, **kwargs):
if self.stdout_data is None and self.stderr_data is None:
return super(_ExtendedPopen, self).communicate(*args, **kwargs)