mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-11 00:58:31 +02:00
run format
This commit is contained in:
parent
9bca32b438
commit
e6a36a9c0a
7 changed files with 6 additions and 10 deletions
|
@ -34,7 +34,6 @@ YAML_FILE_ENCODING = "utf-8"
|
||||||
|
|
||||||
|
|
||||||
def make_yaml_valid_dict(input: list) -> dict:
|
def make_yaml_valid_dict(input: list) -> dict:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Convert a two-element list of configuration key-value pair into a flat dict.
|
Convert a two-element list of configuration key-value pair into a flat dict.
|
||||||
|
|
|
@ -343,7 +343,8 @@ class Journal:
|
||||||
|
|
||||||
def new_entry(self, raw: str, date=None, sort: bool = True) -> Entry:
|
def new_entry(self, raw: str, date=None, sort: bool = True) -> Entry:
|
||||||
"""Constructs a new entry from some raw text input.
|
"""Constructs a new entry from some raw text input.
|
||||||
If a date is given, it will parse and use this, otherwise scan for a date in the input first."""
|
If a date is given, it will parse and use this, otherwise scan for a date in the input first.
|
||||||
|
"""
|
||||||
|
|
||||||
raw = raw.replace("\\n ", "\n").replace("\\n", "\n")
|
raw = raw.replace("\\n ", "\n").replace("\\n", "\n")
|
||||||
# Split raw text into title and body
|
# Split raw text into title and body
|
||||||
|
|
|
@ -9,6 +9,7 @@ from jrnl.config import update_config
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
|
|
||||||
|
|
||||||
# import logging
|
# import logging
|
||||||
def apply_overrides(args: "Namespace", base_config: dict) -> dict:
|
def apply_overrides(args: "Namespace", base_config: dict) -> dict:
|
||||||
"""Unpack CLI provided overrides into the configuration tree.
|
"""Unpack CLI provided overrides into the configuration tree.
|
||||||
|
@ -26,7 +27,6 @@ def apply_overrides(args: "Namespace", base_config: dict) -> dict:
|
||||||
|
|
||||||
cfg_with_overrides = base_config.copy()
|
cfg_with_overrides = base_config.copy()
|
||||||
for pairs in overrides:
|
for pairs in overrides:
|
||||||
|
|
||||||
pairs = make_yaml_valid_dict(pairs)
|
pairs = make_yaml_valid_dict(pairs)
|
||||||
key_as_dots, override_value = _get_key_and_value_from_pair(pairs)
|
key_as_dots, override_value = _get_key_and_value_from_pair(pairs)
|
||||||
keys = _convert_dots_to_list(key_as_dots)
|
keys = _convert_dots_to_list(key_as_dots)
|
||||||
|
|
|
@ -26,7 +26,6 @@ def build_card_header(datestr):
|
||||||
|
|
||||||
class TestFancy:
|
class TestFancy:
|
||||||
def test_too_small_linewrap(self, datestr):
|
def test_too_small_linewrap(self, datestr):
|
||||||
|
|
||||||
journal = "test_journal"
|
journal = "test_journal"
|
||||||
content = build_card_header(datestr)
|
content = build_card_header(datestr)
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,6 @@ def test_get_kv_from_pair():
|
||||||
|
|
||||||
class TestDotNotationToList:
|
class TestDotNotationToList:
|
||||||
def test_unpack_dots_to_list(self):
|
def test_unpack_dots_to_list(self):
|
||||||
|
|
||||||
keys = "a.b.c.d.e.f"
|
keys = "a.b.c.d.e.f"
|
||||||
keys_list = _convert_dots_to_list(keys)
|
keys_list = _convert_dots_to_list(keys)
|
||||||
assert len(keys_list) == 6
|
assert len(keys_list) == 6
|
||||||
|
|
|
@ -229,7 +229,6 @@ def test_version_alone():
|
||||||
|
|
||||||
|
|
||||||
def test_editor_override():
|
def test_editor_override():
|
||||||
|
|
||||||
parsed_args = cli_as_dict('--config-override editor "nano"')
|
parsed_args = cli_as_dict('--config-override editor "nano"')
|
||||||
assert parsed_args == expected_args(config_override=[["editor", "nano"]])
|
assert parsed_args == expected_args(config_override=[["editor", "nano"]])
|
||||||
|
|
||||||
|
@ -293,7 +292,6 @@ class TestDeserialization:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_deserialize_multiword_strings(self, input_str):
|
def test_deserialize_multiword_strings(self, input_str):
|
||||||
|
|
||||||
runtime_config = make_yaml_valid_dict(input_str)
|
runtime_config = make_yaml_valid_dict(input_str)
|
||||||
assert runtime_config.__class__ == dict
|
assert runtime_config.__class__ == dict
|
||||||
assert input_str[0] in runtime_config
|
assert input_str[0] in runtime_config
|
||||||
|
|
Loading…
Add table
Reference in a new issue