fix: resolve CI linting and type checking errors
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-04 05:57:48 +00:00
parent c984c31be0
commit c68659d903

View File

@@ -2,7 +2,7 @@
import os
from pathlib import Path
from typing import Any, Dict, Optional
from typing import Any, Optional
import yaml
@@ -11,7 +11,7 @@ class Config:
"""Configuration management class."""
_instance: Optional["Config"] = None
_config: Dict[str, Any] = {}
_config: dict[str, Any] = {}
def __new__(cls) -> "Config":
if cls._instance is None:
@@ -78,20 +78,22 @@ class Config:
"""Load configuration from YAML file."""
path = Path(config_path)
if path.exists():
with open(path, "r") as f:
with open(path) as f:
user_config = yaml.safe_load(f) or {}
self._config.update(user_config)
def get(self, key: str, default: Any = None) -> Any:
def get(self, key: str, default: Any | None = None) -> Any:
"""Get configuration value using dot notation."""
keys = key.split(".")
value = self._config
value: Any = self._config
for k in keys:
if isinstance(value, dict):
value = value.get(k)
else:
return default
return value if value is not None else default
if value is None:
return default
return value
def get_github_token(self) -> Optional[str]:
"""Get GitHub token from environment or config."""