diff options
Diffstat (limited to 'mesonbuild/interpreterbase/baseobjects.py')
-rw-r--r-- | mesonbuild/interpreterbase/baseobjects.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/interpreterbase/baseobjects.py b/mesonbuild/interpreterbase/baseobjects.py index 7186001..2e675e2 100644 --- a/mesonbuild/interpreterbase/baseobjects.py +++ b/mesonbuild/interpreterbase/baseobjects.py @@ -23,9 +23,16 @@ import typing as T from abc import ABCMeta if T.TYPE_CHECKING: + from typing_extensions import Protocol + # Object holders need the actual interpreter from ..interpreter import Interpreter + __T = T.TypeVar('__T', bound=TYPE_var, contravariant=True) + + class OperatorCall(Protocol[__T]): + def __call__(self, other: __T) -> TYPE_var: ... + TV_fw_var = T.Union[str, int, bool, list, dict, 'InterpreterObject'] TV_fw_args = T.List[T.Union[mparser.BaseNode, TV_fw_var]] TV_fw_kwargs = T.Dict[str, T.Union[mparser.BaseNode, TV_fw_var]] @@ -41,13 +48,6 @@ TYPE_key_resolver = T.Callable[[mparser.BaseNode], str] SubProject = T.NewType('SubProject', str) -if T.TYPE_CHECKING: - from typing_extensions import Protocol - __T = T.TypeVar('__T', bound=TYPE_var, contravariant=True) - - class OperatorCall(Protocol[__T]): - def __call__(self, other: __T) -> TYPE_var: ... - class InterpreterObject: def __init__(self, *, subproject: T.Optional['SubProject'] = None) -> None: self.methods: T.Dict[ |