From 9ae7c83142c880dda13a466966aa0fa2ff51c24c Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 15 Jul 2021 13:21:11 +0100 Subject: [PATCH] Explicitly mark unused arguments 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. --- qiskit/test/decorators.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qiskit/test/decorators.py b/qiskit/test/decorators.py index df1d421d26a4..c2aab763183a 100644 --- a/qiskit/test/decorators.py +++ b/qiskit/test/decorators.py @@ -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 @@ -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 @@ -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__