Skip to content

Commit

Permalink
Update dependency ruff to v0.0.287 (#1778)
Browse files Browse the repository at this point in the history
* Update dependency ruff to v0.0.287

* add ruff target version to tailor linting to our required python versions

* fix linting issues

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Wren <[email protected]>
  • Loading branch information
renovate[bot] and wren authored Sep 9, 2023
1 parent 9533b55 commit 6962c39
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions jrnl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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]}
Expand Down
36 changes: 18 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ filterwarnings = [

[tool.ruff]
line-length = 88
target-version = "py310"

# https://beta.ruff.rs/docs/rules/
select = [
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/then_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}

Expand Down Expand Up @@ -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()}

Expand Down Expand Up @@ -368,15 +368,15 @@ 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), [
set(my_obj),
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), [
Expand Down

0 comments on commit 6962c39

Please sign in to comment.