pgfinder.utils

Utilities

Module Contents

Functions

convert_path(→ pathlib.Path)

Ensure path is Path object.

update_config(→ Dict)

Update the configuration with any arguments

dict_to_decimal(→ dict)

Recursively convert any floats in a dictionary to Decimal.

Attributes

LOGGER

pgfinder.utils.LOGGER
pgfinder.utils.convert_path(path: str | pathlib.Path) pathlib.Path[source]

Ensure path is Path object.

Parameters:

path (Union[str, Path]) – Path to be converted.

Returns:

pathlib Path

Return type:

Path

pgfinder.utils.update_config(config: dict, args: dict | argparse.Namespace) Dict[source]

Update the configuration with any arguments

Parameters:
  • config (dict) – Dictionary of configuration (typically read from YAML file specified with ‘-c/–config <filename>’)

  • args (Namespace) – Command line arguments

Returns:

Dictionary updated with command arguments.

Return type:

Dict

pgfinder.utils.dict_to_decimal(dictionary: dict) dict[source]

Recursively convert any floats in a dictionary to Decimal.

Parameters:

dictionary (dict) – Dictionary to be converted.

Returns:

Dictionary with floats converted to Decimal

Return type:

dict