-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Some type hints in the code could be more specific. For example, the Any type is used in some places where a more specific type could be used.
Example
class BaseService(ABC):
"""Base class for all service implementations."""
def __init__(self, config: dict[str, Any] | None = None) -> None:
"""Initialize service with configuration."""
self.config = config or {}
self.logger = logging.getLogger(self.__class__.__name__)Suggested Improvement
It would be better to define a TypedDict or a dataclass for the configuration to provide more specific type hints.
from typing import TypedDict
class ServiceConfig(TypedDict):
# Define the structure of the configuration here
pass
class BaseService(ABC):
"""Base class for all service implementations."""
def __init__(self, config: ServiceConfig | None = None) -> None:
"""Initialize service with configuration."""
self.config = config or {}
self.logger = logging.getLogger(self.__class__.__name__)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request