From 87ecb78d2f2f0a58fe0ae1060f4a294c10cb3ba6 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Mon, 6 Aug 2018 09:55:43 +0200 Subject: [PATCH 1/2] dist/tests/if_lib: don't invoke super class __init__ Python invokes super class __init__ automatically unless it is overridden. Signed-off-by: Yegor Yefremov --- dist/tests/if_lib/bpt_if.py | 3 --- dist/tests/if_lib/dut_shell.py | 3 --- dist/tests/if_lib/ll_shell.py | 3 --- 3 files changed, 9 deletions(-) diff --git a/dist/tests/if_lib/bpt_if.py b/dist/tests/if_lib/bpt_if.py index f76319b190..190b999983 100644 --- a/dist/tests/if_lib/bpt_if.py +++ b/dist/tests/if_lib/bpt_if.py @@ -16,9 +16,6 @@ class BptIf(LLShell): """Getters and setters for the memory map.""" DEVICE_NUM = 0x42A5 - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - def is_connected_to_board(self): """Checks if board is connected.""" return self.get_sys_device_num()["data"] == self.DEVICE_NUM diff --git a/dist/tests/if_lib/dut_shell.py b/dist/tests/if_lib/dut_shell.py index 1b6f83fcca..0375d5a184 100644 --- a/dist/tests/if_lib/dut_shell.py +++ b/dist/tests/if_lib/dut_shell.py @@ -20,9 +20,6 @@ class DutShell(BaseDevice): RESULT_ERROR = 'Error' RESULT_TIMEOUT = 'Timeout' - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - @staticmethod def _try_parse_data(data): if ('[' in data) and (']' in data): diff --git a/dist/tests/if_lib/ll_shell.py b/dist/tests/if_lib/ll_shell.py index 2cae64a41c..00e5ccd41e 100644 --- a/dist/tests/if_lib/ll_shell.py +++ b/dist/tests/if_lib/ll_shell.py @@ -24,9 +24,6 @@ class LLShell(BaseDevice): RESULT_ERROR = 'Error' RESULT_TIMEOUT = 'Timeout' - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - @staticmethod def _try_parse_data(data): parsed_data = None From ea7fa8bb63bbe1384ed5d8f042472e4dbd17e433 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Mon, 6 Aug 2018 10:19:43 +0200 Subject: [PATCH 2/2] dist/tests/if_lib: use '==' for string comparison Signed-off-by: Yegor Yefremov --- dist/tests/if_lib/driver_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/tests/if_lib/driver_manager.py b/dist/tests/if_lib/driver_manager.py index f51b7b5916..f3f1f2872c 100644 --- a/dist/tests/if_lib/driver_manager.py +++ b/dist/tests/if_lib/driver_manager.py @@ -13,20 +13,20 @@ from .riot_driver import RiotDriver def driver_from_config(dev_type='serial', *args, **kwargs): """Returns driver instance given configuration""" - if dev_type is 'serial': + if dev_type == 'serial': return SerialDriver(*args, **kwargs) - elif dev_type is 'riot': + elif dev_type == 'riot': return RiotDriver(*args, **kwargs) - elif dev_type is 'driver': + elif dev_type == 'driver': return kwargs['driver'] raise NotImplementedError() def available_configs(dev_type='serial', *args, **kwargs): """Returns possible configurations to attempt to connect to.""" - if dev_type is 'serial': + if dev_type == 'serial': return SerialDriver.get_configs(*args, **kwargs) - elif dev_type is 'riot': + elif dev_type == 'riot': return RiotDriver.get_configs(*args, **kwargs) raise NotImplementedError()