From ca80f2d724676e09d1f2cf973a64824dcd71a156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Fri, 1 Dec 2017 16:35:27 +0100 Subject: [PATCH] pylint: Avoid W0102 (dangerous argument) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Despite the reviews we have some W0102s that potentially corrupts the arguments. Let's get rid of them. Signed-off-by: Lukáš Doktor --- avocado/core/dispatcher.py | 4 +++- avocado/utils/gdb.py | 2 +- avocado/utils/wait.py | 6 +++++- selftests/unit/test_job.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/avocado/core/dispatcher.py b/avocado/core/dispatcher.py index 3021c0bb..b9bd33be 100644 --- a/avocado/core/dispatcher.py +++ b/avocado/core/dispatcher.py @@ -34,7 +34,9 @@ class Dispatcher(EnabledExtensionManager): #: Default namespace prefix for Avocado extensions NAMESPACE_PREFIX = 'avocado.plugins.' - def __init__(self, namespace, invoke_kwds={}): + def __init__(self, namespace, invoke_kwds=None): + if invoke_kwds is None: + invoke_kwds = {} self.load_failures = [] super(Dispatcher, self).__init__(namespace=namespace, check_func=self.enabled, diff --git a/avocado/utils/gdb.py b/avocado/utils/gdb.py index 98036312..3e1cd55c 100644 --- a/avocado/utils/gdb.py +++ b/avocado/utils/gdb.py @@ -543,7 +543,7 @@ class GDB(object): raise UnexpectedResponseError return r - def run(self, args=[]): + def run(self, args=None): """ Runs the application inside the debugger diff --git a/avocado/utils/wait.py b/avocado/utils/wait.py index c41a96b5..ce052fe5 100644 --- a/avocado/utils/wait.py +++ b/avocado/utils/wait.py @@ -4,7 +4,7 @@ import time log = logging.getLogger('avocado.test') -def wait_for(func, timeout, first=0.0, step=1.0, text=None, args=[], kwargs={}): +def wait_for(func, timeout, first=0.0, step=1.0, text=None, args=None, kwargs=None): """ Wait until func() evaluates to True. @@ -18,6 +18,10 @@ def wait_for(func, timeout, first=0.0, step=1.0, text=None, args=[], kwargs={}): :param args: Positional arguments to func :param kwargs: Keyword arguments to func """ + if args is None: + args = [] + if kwargs is None: + kwargs = {} start_time = time.time() end_time = time.time() + timeout diff --git a/selftests/unit/test_job.py b/selftests/unit/test_job.py index 0c7847b5..c24c39d9 100644 --- a/selftests/unit/test_job.py +++ b/selftests/unit/test_job.py @@ -24,7 +24,9 @@ class JobTest(unittest.TestCase): self.tmpdir = tempfile.mkdtemp(prefix="avocado_" + __name__) @staticmethod - def _find_simple_test_candidates(candidates=['true', 'time', 'uptime']): + def _find_simple_test_candidates(candidates=None): + if candidates is None: + candidates = ['true', 'time', 'uptime'] found = [] for candidate in candidates: try: -- GitLab