Fix new warnings from flake8

Use isinstance rather than directly comparing types.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
(cherry picked from commit fe2dad3b3c)
This commit is contained in:
Lubomír Sedlář 2023-08-03 10:10:30 +02:00 committed by Stepan Oksanichenko
parent 035fca1e6d
commit c9cbd80569
Signed by: soksanichenko
GPG Key ID: AB9983172AB1E45B
1 changed files with 8 additions and 9 deletions

View File

@ -786,11 +786,10 @@ class KojiWrapper(object):
if list_of_args is None and list_of_kwargs is None:
raise ValueError("One of list_of_args or list_of_kwargs must be set.")
if type(list_of_args) not in [type(None), list] or type(list_of_kwargs) not in [
type(None),
list,
]:
raise ValueError("list_of_args and list_of_kwargs must be list or None.")
if list_of_args is not None and not isinstance(list_of_args, list):
raise ValueError("list_of_args must be list or None.")
if list_of_kwargs is not None and not isinstance(list_of_kwargs, list):
raise ValueError("list_of_kwargs must be list or None.")
if list_of_kwargs is None:
list_of_kwargs = [{}] * len(list_of_args)
@ -804,9 +803,9 @@ class KojiWrapper(object):
koji_session.multicall = True
for args, kwargs in zip(list_of_args, list_of_kwargs):
if type(args) != list:
if not isinstance(args, list):
args = [args]
if type(kwargs) != dict:
if not isinstance(kwargs, dict):
raise ValueError("Every item in list_of_kwargs must be a dict")
koji_session_fnc(*args, **kwargs)
@ -814,7 +813,7 @@ class KojiWrapper(object):
if not responses:
return None
if type(responses) != list:
if not isinstance(responses, list):
raise ValueError(
"Fault element was returned for multicall of method %r: %r"
% (koji_session_fnc, responses)
@ -830,7 +829,7 @@ class KojiWrapper(object):
# a one-item array containing the result value,
# or a struct of the form found inside the standard <fault> element.
for response, args, kwargs in zip(responses, list_of_args, list_of_kwargs):
if type(response) == list:
if isinstance(response, list):
if not response:
raise ValueError(
"Empty list returned for multicall of method %r with args %r, %r" # noqa: E501