From 96661857f91b173fcd27d1ff2fcf5c32c28f1efb Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 9 Sep 2023 15:15:11 -0700 Subject: [PATCH] fix linting issues --- jrnl/config.py | 4 ++-- tests/lib/then_steps.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jrnl/config.py b/jrnl/config.py index 1fdded19..b335204b 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -106,7 +106,7 @@ def scope_config(config: dict, journal_name: str) -> dict: return config config = config.copy() journal_conf = config["journals"].get(journal_name) - if type(journal_conf) is dict: + if isinstance(journal_conf, dict): # We can override the default config on a by-journal basis logging.debug( "Updating configuration with specific journal overrides:\n%s", @@ -181,7 +181,7 @@ def update_config( """Updates a config dict with new values - either global if scope is None or config['journals'][scope] is just a string pointing to a journal file, or within the scope""" - if scope and type(config["journals"][scope]) is dict: # Update to journal specific + if scope and isinstance(config["journals"][scope], dict): config["journals"][scope].update(new_config) elif scope and force_local: # Convert to dict config["journals"][scope] = {"journal": config["journals"][scope]} diff --git a/tests/lib/then_steps.py b/tests/lib/then_steps.py index 7216a23f..84461bc3 100644 --- a/tests/lib/then_steps.py +++ b/tests/lib/then_steps.py @@ -161,7 +161,7 @@ def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml): expected = YAML(typ="safe").load(some_yaml) actual_slice = actual - if type(actual) is dict: + if isinstance(actual, dict): # `expected` objects formatted in yaml only compare one level deep actual_slice = {key: actual.get(key) for key in expected.keys()} @@ -196,7 +196,7 @@ def config_var_in_memory(config_in_memory, journal_name, it_should, some_yaml): expected = YAML(typ="safe").load(some_yaml) actual_slice = actual - if type(actual) is dict: + if isinstance(actual, dict): # `expected` objects formatted in yaml only compare one level deep actual_slice = {key: get_nested_val(actual, key) for key in expected.keys()} @@ -368,7 +368,7 @@ def assert_output_field_content(field_name, comparison, expected_keys, parsed_ou my_obj = my_obj[node] if comparison == "be": - if type(my_obj) is str: + if isinstance(my_obj, str): assert expected_keys == my_obj, [my_obj, expected_keys] else: assert set(expected_keys) == set(my_obj), [ @@ -376,7 +376,7 @@ def assert_output_field_content(field_name, comparison, expected_keys, parsed_ou set(expected_keys), ] elif comparison == "contain": - if type(my_obj) is str: + if isinstance(my_obj, str): assert expected_keys in my_obj, [my_obj, expected_keys] else: assert all(elem in my_obj for elem in expected_keys), [