python: Use isinstance() instead of type()
PATCH 1/1 python: Use isinstance() instead of type()
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"
--- python/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
python/semanage/seobject.py +1 -1
@@ -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
Signature · 1 line
2.41.0
Quoted 8 lines · 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 useis/is not, for instance checks useisinstance()"Use "
isinstance(args, str)" instead of "type(args) == str"Signed-off-by James Carter <[email protected]>
Quoted 19 lines
--- python/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)python/semanage/seobject.py +1
-1@@ -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 = argsSignature · 1 line
2.41.0
Quoted 7 lines · Petr Lautrbach
Quoted 5 lines · 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 useis/is not, for instance checks useisinstance()"
Quoted 5 lines
Quoted 3 lines
Use "
isinstance(args, str)" instead of "type(args) == str"Signed-off-by James Carter <[email protected]>Acked-by Petr Lautrbach <[email protected]>
This is merged now, thanks!
Quoted 20 lines
Quoted 20 lines
--- python/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)python/semanage/seobject.py +1
-1@@ -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 = argsSignature · 1 line
2.41.0