Skip to content

Config reading

read_config_file(path, parse_float=float)

use parse_float argument to select whether you want numbers to be recognized as float or Decimal (typically)

Source code in configcalc/read_cfg_file.py
 8
 9
10
11
12
def read_config_file(path: Path, parse_float: type[float] | Callable[[str], Decimal] = float) -> dict[str, Any]:
    """use parse_float argument to select whether you want numbers to be recognized
    as float or Decimal (typically)"""
    content = tomllib.load(path.open("rb"), parse_float=parse_float)
    return content