Skip to content

jam.utils.config_maker

config_maker

Functions:

Name Description
__config_maker__

Base config masker.

__module_loader__

Loader custom modules from config.

__toml_config_parser__

Private method for parsing TOML config.

__yaml_config_parser__

Private method for parsing YML config.

__config_maker__

__config_maker__(
    config: Union[str, dict[str, Any]],
    pointer: str = GENERIC_POINTER,
) -> dict[str, Any]

Base config masker.

Parameters:

Name Type Description Default
config Union[str, dict[str, Any]

Config dict or file path

required
pointer str

Pointer to config read

GENERIC_POINTER

Returns:

Type Description
dict[str, Any]

dict[str, Any]: Parsed config

__module_loader__

__module_loader__(path: str) -> Callable

Loader custom modules from config.

Parameters:

Name Type Description Default
path str

Path to module. For example: my_app.classes.SomeClass

required

Raises:

Type Description
TypeError

If path not str

Returns:

Type Description
Callable

Callable

__toml_config_parser__

__toml_config_parser__(
    path: str = "pyproject.toml",
    pointer: str = GENERIC_POINTER,
) -> dict[str, Any]

Private method for parsing TOML config.

Parameters:

Name Type Description Default
path str

Path to config.toml

'pyproject.toml'
pointer str

Pointer to config read

GENERIC_POINTER

Raises:

Type Description
FileNotFoundError

If file not found

ValueError

If invalid TOML file

Returns:

Type Description
dict[str, Any]

Dict with config param

__yaml_config_parser__

__yaml_config_parser__(
    path: str, pointer: str = GENERIC_POINTER
) -> dict[str, Any]

Private method for parsing YML config.

Parameters:

Name Type Description Default
path str

Path to config.yml

required
pointer str

Pointer to config read

GENERIC_POINTER

Raises:

Type Description
ImportError

If pyyaml not installed

FileNotFoundError

If file not found

ValueError

If invalid YML

Returns:

Type Description
dict[str, Any]

Dict with configs params

FILE PATH: jam/utils/config_maker.md