tools: change direct type check to isinstance
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 29 Oct 2024 03:26:57 +0000 (13:26 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 29 Oct 2024 03:27:35 +0000 (13:27 +1000)
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>

tools/libinput-measure-touchpad-pressure.py

index 24ab69e04d14b6d5faf99ddbaba5d6434b9ad3f7..6242fb51a809cd2eea584e91514a45bd8374ac5a 100755 (executable)
@@ -66,10 +66,10 @@ class TableFormatter(object):
         s = "|"
         for w, arg in zip(self.colwidths, args):
             w -= 1  # width includes | separator
-            if type(arg) == str:
+            if isinstance(arg, str):
                 # We want space margins for strings
                 s += " {:{width}s} |".format(arg, width=w - 2)
-            elif type(arg) == bool:
+            elif isinstance(arg, bool):
                 s += "{:^{width}s}|".format("x" if arg else " ", width=w)
             else:
                 s += "{:^{width}d}|".format(arg, width=w)