diff --git a/providers/base/bin/accelerometer_test.py b/providers/base/bin/accelerometer_test.py index 130e22d27..cdbe4336e 100755 --- a/providers/base/bin/accelerometer_test.py +++ b/providers/base/bin/accelerometer_test.py @@ -169,7 +169,7 @@ def direction_poll(self, x_axis, y_axis): for mapping, data in direction_map.items(): reading = self.parse_reading(int(data), mapping) - if type(reading) == int: + if isinstance(reading, int): return reading, mapping # Return nothing if threshold is not met @@ -180,7 +180,7 @@ def run(self): while len(rem_tests) > 0: axis_data_bundle = self.grab_current_readings() - if type(axis_data_bundle) != list: + if not isinstance(axis_data_bundle, list): logging.error("Failed to grab appropriate readings") return 1 diff --git a/providers/base/bin/hotkey_tests.py b/providers/base/bin/hotkey_tests.py index 3ff50f6e9..dedb9a422 100755 --- a/providers/base/bin/hotkey_tests.py +++ b/providers/base/bin/hotkey_tests.py @@ -372,7 +372,7 @@ def press_key(self, key_code, modifiers=set(), repetitions=1, delay=0.05): while repetitions: if not modifiers.issubset({'alt', 'ctrl', 'shift', 'meta'}): raise SystemExit('Unknown modifier') - if type(key_code) == KeyCodes: + if isinstance(key_code, KeyCodes): key_code = key_code.value data = bytes() data += self.event_struct.pack(0, 0, 4, 4, key_code) diff --git a/providers/base/bin/key_test.py b/providers/base/bin/key_test.py index f94abd3a6..e734fbbda 100755 --- a/providers/base/bin/key_test.py +++ b/providers/base/bin/key_test.py @@ -165,7 +165,7 @@ def on_key(self, source, cb_condition): # Check for ESC key pressed self.show_text(_("Test cancelled")) self.quit() - elif 1 < code < 10 and type(self) == CLIReporter: + elif 1 < code < 10 and isinstance(self, CLIReporter): # Check for number to skip self.toggle_key(self.keys[code - 2]) else: