Skip to content

comicbox.config ΒΆ

Confuse config for comicbox.

get_config(args=None, *, modname=PACKAGE_NAME, path=None, box=False) ΒΆ

Get the config dict, layering env and args over defaults.

Source code in comicbox/config/__init__.py
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
def get_config(
    args: Namespace | Mapping | ComicboxSettings | None = None,
    *,
    modname: str = PACKAGE_NAME,
    path: str | Path | None = None,
    box: bool = False,
) -> ComicboxSettings:
    """Get the config dict, layering env and args over defaults."""
    if isinstance(args, ComicboxSettings):
        return post_process_set_for_path(args, path, box=box)
    if args is None and modname == PACKAGE_NAME:
        settings = _get_default_settings()
    else:
        if isinstance(args, Mapping):
            args = dict(args)
        settings = _read_settings(args, modname)
    return post_process_set_for_path(settings, path, box=box)