From 2be0d3729e093fec623809795f68288765fb6347 Mon Sep 17 00:00:00 2001 From: Suhas Date: Mon, 1 Feb 2021 13:30:59 -0500 Subject: [PATCH] Simplify config override syntax (#8) * update tests and expected behavior * clean up arg parsing tests * update deserialization * update deserialization * config argparse action * update override application logic * update tests; delete unused imports * override param must be list * update docstring * update test input to SUT * update remaining override unittests * make format * forgot to update CLI syntax --- jrnl/args.py | 2 ++ jrnl/override.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/jrnl/args.py b/jrnl/args.py index 4e7c1199..b3a04192 100644 --- a/jrnl/args.py +++ b/jrnl/args.py @@ -18,6 +18,7 @@ from .plugins import util def deserialize_config_args(input: list) -> dict: + """ Convert a two-element list of configuration key-value pair into a flat dict @@ -44,6 +45,7 @@ def deserialize_config_args(input: list) -> dict: cfg_value = False runtime_modifications[cfg_key] = cfg_value + return runtime_modifications diff --git a/jrnl/override.py b/jrnl/override.py index 5eb00a39..82d6da93 100644 --- a/jrnl/override.py +++ b/jrnl/override.py @@ -11,9 +11,11 @@ def apply_overrides(overrides: list, base_config: dict) -> dict: """ config = base_config.copy() for pairs in overrides: + key_as_dots, override_value = list(pairs.items())[0] keys = key_as_dots.split(".") config = _recursively_apply(config, keys, override_value) + return config