From d4cf2d266663ae412360037255b7bdec98216927 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:28:05 +1000 Subject: [PATCH] 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. --- invokeai/app/api/dependencies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/app/api/dependencies.py b/invokeai/app/api/dependencies.py index b25009c8c9..8d4ec2e0ce 100644 --- a/invokeai/app/api/dependencies.py +++ b/invokeai/app/api/dependencies.py @@ -55,7 +55,7 @@ logger = InvokeAILogger.getLogger() class ApiDependencies: """Contains and initializes all dependencies for the API""" - invoker: Optional[Invoker] = None + invoker: Invoker @staticmethod def initialize(config: InvokeAIAppConfig, event_handler_id: int, logger: Logger = logger):