models.config
1#!/usr/bin/env python3 2 3from typing import Any 4 5from pydantic import BaseModel, Field 6 7 8class Config(BaseModel): 9 """Pydantic model for application configuration. 10 11 The YAML file contains a flat hierarchy of sections. Each section is 12 represented as a dictionary; the data is exposed via ``e_lib.Config.data``. 13 """ 14 15 General: dict[str, Any] = Field(default_factory=dict) 16 Logger: dict[str, Any] = Field(default_factory=dict) 17 Devices: dict[str, Any] = Field(default_factory=dict) 18 Messengers: dict[str, Any] = Field(default_factory=dict) 19 Assistants: dict[str, Any] = Field(default_factory=dict) 20 OpenWeather: dict[str, Any] = Field(default_factory=dict) 21 22 class Config: 23 # Allow arbitrary keys to be preserved – the YAML may contain more 24 # sections than we explicitly model. 25 extra = "allow"
class
Config(pydantic.main.BaseModel):
9class Config(BaseModel): 10 """Pydantic model for application configuration. 11 12 The YAML file contains a flat hierarchy of sections. Each section is 13 represented as a dictionary; the data is exposed via ``e_lib.Config.data``. 14 """ 15 16 General: dict[str, Any] = Field(default_factory=dict) 17 Logger: dict[str, Any] = Field(default_factory=dict) 18 Devices: dict[str, Any] = Field(default_factory=dict) 19 Messengers: dict[str, Any] = Field(default_factory=dict) 20 Assistants: dict[str, Any] = Field(default_factory=dict) 21 OpenWeather: dict[str, Any] = Field(default_factory=dict) 22 23 class Config: 24 # Allow arbitrary keys to be preserved – the YAML may contain more 25 # sections than we explicitly model. 26 extra = "allow"
Pydantic model for application configuration.
The YAML file contains a flat hierarchy of sections. Each section is
represented as a dictionary; the data is exposed via e_lib.Config.data.
class
Config.Config: