diff --git a/src/cpl_core/configuration/configuration_abc.py b/src/cpl_core/configuration/configuration_abc.py index 1f4c8e3e..16beb725 100644 --- a/src/cpl_core/configuration/configuration_abc.py +++ b/src/cpl_core/configuration/configuration_abc.py @@ -77,11 +77,11 @@ class ConfigurationABC(ABC): pass @abstractmethod - def add_configuration(self, key_type: Type[T], value: any): + def add_configuration(self, key_type: T, value: any): r"""Add configuration object Parameter: - key_type: Union[:class:`str`, :class:`type`] + key_type: :class:`cpl_core.type.T` Type of the value value: any Object of the value @@ -124,11 +124,11 @@ class ConfigurationABC(ABC): pass @abstractmethod - def get_configuration(self, search_type: Type[T]) -> Optional[T]: + def get_configuration(self, search_type: T) -> Optional[T]: r"""Returns value from configuration by given type Parameter: - search_type: Union[:class:`str`, Type[:class:`cpl_core.configuration.configuration_model_abc.ConfigurationModelABC`]] + search_type: :class:`cpl_core.type.T` Type to search for Returns: diff --git a/src/cpl_core/dependency_injection/service_provider.py b/src/cpl_core/dependency_injection/service_provider.py index 870b4d27..3b63eaa3 100644 --- a/src/cpl_core/dependency_injection/service_provider.py +++ b/src/cpl_core/dependency_injection/service_provider.py @@ -138,7 +138,7 @@ class ServiceProvider(ServiceProviderABC): sb = ScopeBuilder(ServiceProvider(descriptors, self._configuration, self._database_context)) return sb.build() - def get_service(self, service_type: typing.Type[T], *args, **kwargs) -> Optional[T]: + def get_service(self, service_type: T, *args, **kwargs) -> Optional[T]: result = self._find_service(service_type) if result is None: diff --git a/src/cpl_core/dependency_injection/service_provider_abc.py b/src/cpl_core/dependency_injection/service_provider_abc.py index c5d6e7eb..3af4b5fe 100644 --- a/src/cpl_core/dependency_injection/service_provider_abc.py +++ b/src/cpl_core/dependency_injection/service_provider_abc.py @@ -61,7 +61,7 @@ class ServiceProviderABC(ABC): pass @abstractmethod - def get_service(self, instance_type: Type[T], *args, **kwargs) -> Optional[T]: + def get_service(self, instance_type: T, *args, **kwargs) -> Optional[T]: r"""Returns instance of given type Parameter @@ -81,7 +81,7 @@ class ServiceProviderABC(ABC): Parameter --------- - instance_type: :class:`cpl_core.type.T` + service_type: :class:`cpl_core.type.T` The type of the searched instance Returns diff --git a/src/cpl_discord/service/discord_service.py b/src/cpl_discord/service/discord_service.py index 9ddb5a4a..82bcd35a 100644 --- a/src/cpl_discord/service/discord_service.py +++ b/src/cpl_discord/service/discord_service.py @@ -99,7 +99,6 @@ class DiscordService(DiscordServiceABC, commands.Cog, metaclass=DiscordCogMeta): try: for command in self._services.get_services(DiscordCommandABC): self._logger.trace(__name__, f"Register command {type(command).__name__}") - command: Cog = command if command is None: self._logger.warn(__name__, f"Instance of {type(command).__name__} not found") continue