misc: small formatting and error checking improvements

This commit is contained in:
Oystein Kristoffer Tveit 2024-01-14 03:41:40 +01:00
parent 369180ff85
commit 03f221a807
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
2 changed files with 9 additions and 6 deletions

View File

@ -24,6 +24,9 @@ class Config:
] ]
def __class_getitem__(cls, name: str) -> Any: def __class_getitem__(cls, name: str) -> Any:
if cls._config is None:
raise RuntimeError('Configuration not loaded, call Config.load_configuration() first.')
__config = cls._config __config = cls._config
for attr in name.split('.'): for attr in name.split('.'):
__config = __config.get(attr) __config = __config.get(attr)