diff --git a/scripts/neohub_cli.py b/scripts/neohub_cli.py index 6c00cae..18366ca 100755 --- a/scripts/neohub_cli.py +++ b/scripts/neohub_cli.py @@ -91,9 +91,9 @@ class NeoHubCLI(object): arg_types = [] for p in sig.parameters: a = sig.parameters[p].annotation - if type(a) == type: + if isinstance(a, type): arg_types.append(a) - elif type(a) == list: + elif isinstance(a, list): if a[0] == NeoStat: arg_types.append(a[0]) else: @@ -204,14 +204,14 @@ class NeoHubCLI(object): if special_case: return special_case(raw_result, output_format) - if type(raw_result) == bool: + if isinstance(raw_result, bool): return 'Command Succeeded' if raw_result else 'Command Failed' if type(raw_result) in (int, str): return f'{raw_result}' - if type(raw_result) != types.SimpleNamespace: - if type(raw_result) == dict: + if not isinstance(raw_result, types.SimpleNamespace): + if isinstance(raw_result, dict): raw_result = types.SimpleNamespace(**raw_result) else: raise NeoHubCLIInternalError( @@ -225,7 +225,7 @@ class NeoHubCLI(object): """ if type(val) in (ScheduleFormat, Weekday): return val.value - elif type(val) == NeoStat: + elif isinstance(val, NeoStat): return f'[NeoStat: {val.name}]' else: return val