All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] python: Use isinstance() instead of type()
@ 2023-08-03 13:40 James Carter
  2023-08-08 10:30 ` Petr Lautrbach
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2023-08-03 13:40 UTC (permalink / raw)
  To: selinux; +Cc: James Carter

CI testing fails while running flake8 on python scripts with the
message "./python/semanage/seobject.py:250:16: E721 do not compare
types, for exact checks use `is` / `is not`, for instance checks use
`isinstance()`"

Use "isinstance(args, str)" instead of "type(args) == str"

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 python/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
index 361205d1..cc944ae2 100644
--- a/python/semanage/seobject.py
+++ b/python/semanage/seobject.py
@@ -247,7 +247,7 @@ class semanageRecords:
         global handle
         if args:
             # legacy code - args was store originally
-            if type(args) == str:
+            if isinstance(args, str):
                 self.store = args
             else:
                 self.args = args
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-08 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03 13:40 [PATCH] python: Use isinstance() instead of type() James Carter
2023-08-08 10:30 ` Petr Lautrbach
2023-08-08 11:01   ` Petr Lautrbach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.