diff --git a/__typing.py b/__typing.py new file mode 100644 index 0000000..5ae9d6b --- /dev/null +++ b/__typing.py @@ -0,0 +1,8 @@ +# encoding: utf-8 +""" +""" + +from typing import TypeVar as _TypeVar + +T = _TypeVar('T') +T2 = _TypeVar('T2') diff --git a/enums.py b/enums.py index a04c4ab..bdcceeb 100644 --- a/enums.py +++ b/enums.py @@ -10,9 +10,7 @@ try: except ImportError: from comfy.comfy_types.node_typing import StrEnum as _StrEnum - -T = _t.TypeVar('T') -T2 = _t.TypeVar('T2') +from .__typing import T as _T class __BaseEnum(_StrEnum): @@ -26,7 +24,7 @@ class DataTypes(__BaseEnum): DICT = 'DICT' @staticmethod - def __custom_input_type_dict(_dict_args: _t.Tuple[_t.Dict[str, T], ...], kwargs: _t.Dict[str, T]) -> _t.Dict[str, T]: + def __custom_input_type_dict(_dict_args: _t.Tuple[_t.Dict[str, _T], ...], kwargs: _t.Dict[str, _T]) -> _t.Dict[str, _T]: res_dict: _t.Dict[str, _t.Any] = {"forceInput": True} for d in _dict_args: if d is not None: @@ -35,5 +33,5 @@ class DataTypes(__BaseEnum): return res_dict @classmethod - def input_dict(cls, *_dicts: _t.Dict[str, T], **kwargs: T) -> _t.Tuple[_t.Union['DataTypes', str], _t.Dict[str, T]]: + def input_dict(cls, *_dicts: _t.Dict[str, _T], **kwargs: _T) -> _t.Tuple[_t.Union['DataTypes', str], _t.Dict[str, _T]]: return str(cls.DICT), cls.__custom_input_type_dict(_dicts, kwargs) diff --git a/funcs_common.py b/funcs_common.py index 6c5ec7c..042ffd1 100644 --- a/funcs_common.py +++ b/funcs_common.py @@ -11,7 +11,7 @@ from frozendict import deepfreeze as _deepfreeze, frozendict as _frozendict from server import PromptServer as _PromptServer -from .enums import T as _T, T2 as _T2 +from .__typing import T as _T, T2 as _T2 def _show_text_on_node(text: str = None, unique_id: str = None):