fix(api): fix ApiDependencies.invoker types

ApiDependencies.invoker` provides typing for the API's services layer. Marking it `Optional` results in all the routes seeing it as optional, which is not good.

Instead of marking it optional to satisfy the initial assignment to `None`, we can just skip the initial assignment. This preserves the IDE hinting in API layer and is types-legal.
This commit is contained in:
psychedelicious 2023-08-01 17:28:05 +10:00
parent b8b589c150
commit d4cf2d2666

View File

@ -55,7 +55,7 @@ logger = InvokeAILogger.getLogger()
class ApiDependencies: class ApiDependencies:
"""Contains and initializes all dependencies for the API""" """Contains and initializes all dependencies for the API"""
invoker: Optional[Invoker] = None invoker: Invoker
@staticmethod @staticmethod
def initialize(config: InvokeAIAppConfig, event_handler_id: int, logger: Logger = logger): def initialize(config: InvokeAIAppConfig, event_handler_id: int, logger: Logger = logger):