mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2026-02-18 17:18:45 +01:00
updates type hints, implements linting suggestions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import Optional, TypeVar
|
||||
from typing import TypeVar
|
||||
|
||||
from confz import BaseConfig, FileSource
|
||||
|
||||
@@ -15,7 +15,7 @@ class NoConfigSourceError(Exception):
|
||||
|
||||
def create_config(
|
||||
config_class: type[T],
|
||||
config_folder: Optional[Path | str] = None,
|
||||
config_folder: Path | str | None = None,
|
||||
config_file: str = "",
|
||||
) -> T:
|
||||
if config_class.CONFIG_SOURCES is not None or config_folder is not None:
|
||||
@@ -23,13 +23,13 @@ def create_config(
|
||||
if config_folder is not None:
|
||||
config_sources = FileSource(Path(config_folder) / config_file)
|
||||
return config_class(config_sources=config_sources)
|
||||
else:
|
||||
error_msg = (
|
||||
"No 'database_config' folder found in the root directory. Please ensure "
|
||||
"that a 'database_config' folder exists in your project's root directory. "
|
||||
"Alternatively, you can provide a different config folder by passing its "
|
||||
"path to the constructor."
|
||||
)
|
||||
logger.error(error_msg)
|
||||
|
||||
raise NoConfigSourceError(error_msg)
|
||||
error_msg = (
|
||||
"No 'database_config' folder found in the root directory. Please ensure "
|
||||
"that a 'database_config' folder exists in your project's root directory. "
|
||||
"Alternatively, you can provide a different config folder by passing its "
|
||||
"path to the constructor."
|
||||
)
|
||||
logger.error(error_msg)
|
||||
|
||||
raise NoConfigSourceError(error_msg)
|
||||
|
||||
Reference in New Issue
Block a user