Fixed types

This commit is contained in:
Sven Heidemann 2023-10-12 20:55:24 +02:00
parent b3fd122fcd
commit 7881294554
4 changed files with 7 additions and 8 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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