Make merge_dicts() re-useable
This commit is contained in:
parent
f3579e78af
commit
e578d41adb
@ -14,8 +14,8 @@ from contextlib import contextmanager
|
|||||||
|
|
||||||
from . import fast_data_types as defines
|
from . import fast_data_types as defines
|
||||||
from .config_utils import (
|
from .config_utils import (
|
||||||
init_config, parse_config_base, positive_float, positive_int, to_bool,
|
init_config, load_config as _load_config, merge_dicts, parse_config_base,
|
||||||
to_color, unit_float, load_config as _load_config
|
positive_float, positive_int, to_bool, to_color, unit_float
|
||||||
)
|
)
|
||||||
from .constants import cache_dir, defconf
|
from .constants import cache_dir, defconf
|
||||||
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
from .fast_data_types import CURSOR_BEAM, CURSOR_BLOCK, CURSOR_UNDERLINE
|
||||||
@ -423,12 +423,6 @@ def merge_keys(ans, defaults, newvals):
|
|||||||
ans['sequence_map'] = {k: v for k, v in ans['sequence_map'].items() if v}
|
ans['sequence_map'] = {k: v for k, v in ans['sequence_map'].items() if v}
|
||||||
|
|
||||||
|
|
||||||
def merge_dicts(defaults, newvals):
|
|
||||||
ans = defaults.copy()
|
|
||||||
ans.update(newvals)
|
|
||||||
return ans
|
|
||||||
|
|
||||||
|
|
||||||
def merge_configs(defaults, vals):
|
def merge_configs(defaults, vals):
|
||||||
ans = {}
|
ans = {}
|
||||||
for k, v in defaults.items():
|
for k, v in defaults.items():
|
||||||
|
|||||||
@ -117,6 +117,12 @@ def create_options_class(keys):
|
|||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def merge_dicts(defaults, newvals):
|
||||||
|
ans = defaults.copy()
|
||||||
|
ans.update(newvals)
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
def load_config(Options, defaults, parse_config, merge_configs, *paths, overrides=None):
|
def load_config(Options, defaults, parse_config, merge_configs, *paths, overrides=None):
|
||||||
ans = defaults._asdict()
|
ans = defaults._asdict()
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user