simplified few type hints

This commit is contained in:
Jakub Trllo 2025-08-15 12:48:10 +02:00
parent 53d0d4985a
commit ec92be4cae
4 changed files with 8 additions and 16 deletions

View file

@ -49,15 +49,12 @@ from .creator_plugins import (
discover_convertor_plugins,
)
if typing.TYPE_CHECKING:
from ayon_core.host import HostBase
from ayon_core.lib import AbstractAttrDef
from ayon_core.lib.events import EventCallback, Event
from .structures import CreatedInstance
from .creator_plugins import BaseCreator
class PublishHost(HostBase, IPublishHost):
pass
# Import of functions and classes that were moved to different file
# TODO Should be removed in future release - Added 24/08/28, 0.4.3-dev.1
@ -163,7 +160,7 @@ class CreateContext:
context which should be handled by host.
Args:
host (PublishHost): Host implementation which handles implementation
host (IPublishHost): Host implementation which handles implementation
and global metadata.
headless (bool): Context is created out of UI (Current not used).
reset (bool): Reset context on initialization.
@ -173,7 +170,7 @@ class CreateContext:
def __init__(
self,
host: "PublishHost",
host: IPublishHost,
headless: bool = False,
reset: bool = True,
discover_publish_plugins: bool = True,

View file

@ -13,7 +13,7 @@ from typing import (
)
from ayon_core.lib import AbstractAttrDef
from ayon_core.host import HostBase
from ayon_core.host import AbstractHost
from ayon_core.pipeline.create import (
CreateContext,
ConvertorItem,
@ -176,7 +176,7 @@ class AbstractPublisherBackend(AbstractPublisherCommon):
pass
@abstractmethod
def get_host(self) -> HostBase:
def get_host(self) -> AbstractHost:
pass
@abstractmethod

View file

@ -1,7 +1,7 @@
import ayon_api
from ayon_core.lib.events import QueuedEventSystem
from ayon_core.host import HostBase
from ayon_core.host import ILoadHost
from ayon_core.pipeline import (
registered_host,
get_current_context,
@ -35,7 +35,7 @@ class SceneInventoryController:
self._projects_model = ProjectsModel(self)
self._event_system = self._create_event_system()
def get_host(self) -> HostBase:
def get_host(self) -> ILoadHost:
return self._host
def emit_event(self, topic, data=None, source=None):

View file

@ -14,7 +14,6 @@ from ayon_core.lib import (
Logger,
)
from ayon_core.host import (
HostBase,
IWorkfileHost,
WorkfileInfo,
PublishedWorkfileInfo,
@ -49,19 +48,15 @@ if typing.TYPE_CHECKING:
_NOT_SET = object()
class HostType(HostBase, IWorkfileHost):
pass
class WorkfilesModel:
"""Workfiles model."""
def __init__(
self,
host: HostType,
host: IWorkfileHost,
controller: AbstractWorkfilesBackend
):
self._host: HostType = host
self._host: IWorkfileHost = host
self._controller: AbstractWorkfilesBackend = controller
self._log = Logger.get_logger("WorkfilesModel")