From 568a4844f7bbed88e7c336bf9f4febba19320885 Mon Sep 17 00:00:00 2001 From: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Sun, 9 Jun 2024 14:04:43 +0530 Subject: [PATCH] fix: other recursive imports --- .../app/services/download/download_default.py | 5 +---- invokeai/app/services/events/events_base.py | 1 - .../model_install/model_install_default.py | 18 +++++++++--------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/invokeai/app/services/download/download_default.py b/invokeai/app/services/download/download_default.py index 4640a656dc..f6c7c1a1a0 100644 --- a/invokeai/app/services/download/download_default.py +++ b/invokeai/app/services/download/download_default.py @@ -8,7 +8,7 @@ import time import traceback from pathlib import Path from queue import Empty, PriorityQueue -from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Set +from typing import Any, Dict, List, Literal, Optional, Set import requests from pydantic.networks import AnyHttpUrl @@ -34,9 +34,6 @@ from .download_base import ( UnknownJobIDException, ) -if TYPE_CHECKING: - from invokeai.app.services.events.events_base import EventServiceBase - # Maximum number of bytes to download during each call to requests.iter_content() DOWNLOAD_CHUNK_SIZE = 100000 diff --git a/invokeai/app/services/events/events_base.py b/invokeai/app/services/events/events_base.py index 3c0fb0a30b..cf49cc0626 100644 --- a/invokeai/app/services/events/events_base.py +++ b/invokeai/app/services/events/events_base.py @@ -34,7 +34,6 @@ from invokeai.backend.stable_diffusion.diffusers_pipeline import PipelineInterme if TYPE_CHECKING: from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput from invokeai.app.services.download.download_base import DownloadJob - from invokeai.app.services.events.events_common import EventBase from invokeai.app.services.model_install.model_install_common import ModelInstallJob from invokeai.app.services.session_processor.session_processor_common import ProgressImage from invokeai.app.services.session_queue.session_queue_common import ( diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 39e38a593f..0a2e2d798a 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -9,7 +9,7 @@ from pathlib import Path from queue import Empty, Queue from shutil import copyfile, copytree, move, rmtree from tempfile import mkdtemp -from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type, Union +from typing import Any, Dict, List, Optional, Tuple, Type, Union import torch import yaml @@ -60,9 +60,6 @@ from .model_install_common import ( TMPDIR_PREFIX = "tmpinstall_" -if TYPE_CHECKING: - from invokeai.app.services.events.events_base import EventServiceBase - class ModelInstallService(ModelInstallServiceBase): """class for InvokeAI model installation.""" @@ -412,11 +409,14 @@ class ModelInstallService(ModelInstallServiceBase): if isinstance(source, HFModelSource): metadata = HuggingFaceMetadataFetch(self._session).from_id(source.repo_id, source.variant) assert isinstance(metadata, ModelMetadataWithFiles) - return metadata.download_urls( - variant=source.variant or self._guess_variant(), - subfolder=source.subfolder, - session=self._session, - ), metadata + return ( + metadata.download_urls( + variant=source.variant or self._guess_variant(), + subfolder=source.subfolder, + session=self._session, + ), + metadata, + ) if isinstance(source, URLModelSource): try: