configs#

This module contains the BaseConfig class, which is a simple configuration class designed to work similarly to pydantic BaseModel.

BaseConfig#

class pocketwelt.configs.BaseConfig(**kwargs: Any)#

Bases: SimpleNamespace

Simple configuration class designed to work as pydantic BaseModel.

Example

class ExampleConfig(BaseConfig):
    host: str
    port: int
    use_ssl: bool = False

# Example usage
example_config = ExampleConfig(host="localhost", port=8080)
print(example_config.host)  # Output: localhost
print(example_config.port)  # Output: 8080
print(example_config.use_ssl)  # Output: False
to_dict() Dict[str, Any]#

Save the configuration to a dictionary.

Returns:

A dictionary representation of the configuration.

Return type:

Dict[str, Any]

to_txt(save_path: str) None#

Save the current config to a text file.

Parameters:

save_path (str) – Path where the configuration text file will be saved.