flake8 reported:
tests/ftests/cgroup.py:1171:33: E721 do not compare types, for exact
checks use is / is not, for instance checks use isinstance()
tests/ftests/cgroup.py:1173:14: E721 do not compare types, for exact
checks use is / is not, for instance checks use isinstance()
The helper only needs to distinguish between string, list, or None
inputs, so replace the raw type() comparisons with isinstance() calls.
That keeps the behaviour unchanged while removing the lint warning.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
# path for all three cgroup setup modes, including empty cgroup v2.
@staticmethod
def exists(config, ctrl_name, cgroup_name, ignore_systemd=False):
- if ctrl_name is None or type(ctrl_name) == str:
+ if ctrl_name is None or isinstance(ctrl_name, str):
return Cgroup.__exists(config, ctrl_name, cgroup_name, ignore_systemd)
- elif type(ctrl_name) == list:
+ elif isinstance(ctrl_name, list):
for ctrl in ctrl_name:
if not Cgroup.__exists(config, ctrl, cgroup_name, ignore_systemd):
# if any of the controllers don't exist, fail the check