ref: Rename configparser to cfg

This commit is contained in:
Marty Oehme 2025-11-26 18:38:18 +01:00
parent a088fcbe76
commit fccfb85026
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -257,14 +257,14 @@ def parse_conf(conf_file: Path) -> dict:
Returns them as a simple dict object.
Uses dot.annotation for options just like taskwarrior settings.
"""
c = configparser.ConfigParser(allow_unnamed_section=True, allow_no_value=True)
cfg = configparser.ConfigParser(allow_unnamed_section=True, allow_no_value=True)
with open(conf_file.expanduser()) as f:
c.read_string("[GENERAL]\n" + f.read())
cfg.read_string("[GENERAL]\n" + f.read())
ConfTrans = namedtuple("ParsedToTConf", ["name", "tconf_name"])
return _filtered_dict(
{
opt.tconf_name: c.get("GENERAL", opt.name)
opt.tconf_name: cfg.get("GENERAL", opt.name)
for opt in [
ConfTrans("data.location", "task_data"),
ConfTrans("notes.dir", "notes_dir"),
@ -273,7 +273,7 @@ def parse_conf(conf_file: Path) -> dict:
ConfTrans("notes.editor", "notes_editor"),
ConfTrans("notes.quiet", "notes_quiet"),
]
if c.has_option("GENERAL", opt.name)
if cfg.has_option("GENERAL", opt.name)
}
)