From 29dc4b68ec91fb070d77320d33ff8bf9142c52d4 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Tue, 18 Apr 2023 11:35:36 +0300 Subject: [PATCH] twister: Cleanup redundant if / else Convert following construction: elif self.options.device_serial or self.options.device_serial_pty: if self.options.device_serial: ... else ... to the construction: elif self.options.device_serial: ... else self.options.device_serial_pty: ... Signed-off-by: Andrei Emeltchenko --- .../pylib/twister/twisterlib/hardwaremap.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index 5dc1cef29a4..8f429885e56 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -169,24 +169,24 @@ class HardwareMap: if d.connected: self.options.platform.append(d.platform) - elif self.options.device_serial or self.options.device_serial_pty: - if self.options.device_serial: - self.add_device(self.options.device_serial, - self.options.platform[0], - self.options.pre_script, - False, - baud=self.options.device_serial_baud, - flash_timeout=self.options.device_flash_timeout, - flash_with_test=self.options.device_flash_with_test - ) - else: - self.add_device(self.options.device_serial_pty, - self.options.platform[0], - self.options.pre_script, - True, - flash_timeout=self.options.device_flash_timeout, - flash_with_test=self.options.device_flash_with_test - ) + elif self.options.device_serial: + self.add_device(self.options.device_serial, + self.options.platform[0], + self.options.pre_script, + False, + baud=self.options.device_serial_baud, + flash_timeout=self.options.device_flash_timeout, + flash_with_test=self.options.device_flash_with_test + ) + + elif self.options.device_serial_pty: + self.add_device(self.options.device_serial_pty, + self.options.platform[0], + self.options.pre_script, + True, + flash_timeout=self.options.device_flash_timeout, + flash_with_test=self.options.device_flash_with_test + ) # the fixtures given by twister command explicitly should be assigned to each DUT if self.options.fixture: