Skip to content

Commit

Permalink
Explicitly mark unused arguments
Browse files Browse the repository at this point in the history
The decorator's internal functions take arguments *args and **kwargs,
in order to wrap arbitrary functions, but pylint complains about them
not being used.  The arguments are explicitly meant to be ignored, which
in pylint-speak means prepending with an underscore.
  • Loading branch information
jakelishman committed Jul 15, 2021
1 parent ef4bc3c commit 9ae7c83
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qiskit/test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ def enforce_subclasses_call(methods, attr="_enforce_subclasses_call_cache"):

methods = {methods} if isinstance(methods, str) else set(methods)

def initialize_call_memory(self, *args, **kwargs):
def initialize_call_memory(self, *_args, **_kwargs):
"""Add the extra attribute used for tracking the method calls."""
setattr(self, attr, set())

def save_call_status(name):
"""Decorator, whose return saves the fact that the top-level method call occurred."""

def out(self, *args, **kwargs):
def out(self, *_args, **_kwargs):
getattr(self, attr).add(name)

return out
Expand All @@ -326,7 +326,7 @@ def clear_call_status(name):
"""Decorator, whose return clears the call status of the method ``name``. This prepares the
call tracking for the child class's method call."""

def out(self, *args, **kwargs):
def out(self, *_args, **_kwargs):
getattr(self, attr).discard(name)

return out
Expand All @@ -335,7 +335,7 @@ def enforce_call_occurred(name):
"""Decorator, whose return checks that the top-level method call occurred, and raises
``ValueError`` if not. Concretely, this is an assertion that ``save_call_status`` ran."""

def out(self, *args, **kwargs):
def out(self, *_args, **_kwargs):
cache = getattr(self, attr)
if name not in cache:
classname = self.__name__ if isinstance(self, type) else type(self).__name__
Expand Down

0 comments on commit 9ae7c83

Please sign in to comment.