MCPcopy
hub / github.com/dbcli/pgcli / load_config

Function load_config

pgcli/config.py:19–29  ·  view source on GitHub ↗
(usr_cfg, def_cfg=None)

Source from the content-addressed store, hash-verified

17
18
19def load_config(usr_cfg, def_cfg=None):
20 # avoid config merges when possible. For writing, we need an umerged config instance.
21 # see https://github.com/dbcli/pgcli/issues/1240 and https://github.com/DiffSK/configobj/issues/171
22 if def_cfg:
23 cfg = ConfigObj()
24 cfg.merge(ConfigObj(def_cfg, interpolation=False))
25 cfg.merge(ConfigObj(expanduser(usr_cfg), interpolation=False, encoding="utf-8"))
26 else:
27 cfg = ConfigObj(expanduser(usr_cfg), interpolation=False, encoding="utf-8")
28 cfg.filename = expanduser(usr_cfg)
29 return cfg
30
31
32def ensure_dir_exists(path):

Callers 4

upgrade_configFunction · 0.85
get_configFunction · 0.85
__init__Method · 0.85
cliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected