(usr_cfg, def_cfg=None)
| 17 | |
| 18 | |
| 19 | def 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 | |
| 32 | def ensure_dir_exists(path): |
no outgoing calls
no test coverage detected