Remove unused code in interpreterbase

pull/12333/head
Tristan Partin 1 year ago committed by Eli Schwartz
parent 87993b8210
commit 88b337b77c
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 8
      mesonbuild/interpreterbase/__init__.py
  2. 3
      mesonbuild/interpreterbase/baseobjects.py
  3. 16
      mesonbuild/interpreterbase/decorators.py

@ -46,7 +46,6 @@ __all__ = [
'disablerIfNotFound',
'permittedKwargs',
'typed_operator',
'unary_operator',
'typed_pos_args',
'ContainerTypeInfo',
'KwargInfo',
@ -62,9 +61,6 @@ __all__ = [
'SubProject',
'TV_fw_var',
'TV_fw_args',
'TV_fw_kwargs',
'TV_func',
'TYPE_elementary',
'TYPE_var',
@ -85,9 +81,6 @@ from .baseobjects import (
MutableInterpreterObject,
ContextManagerObject,
TV_fw_var,
TV_fw_args,
TV_fw_kwargs,
TV_func,
TYPE_elementary,
TYPE_var,
@ -115,7 +108,6 @@ from .decorators import (
ContainerTypeInfo,
KwargInfo,
typed_operator,
unary_operator,
typed_kwargs,
FeatureCheckBase,
FeatureNew,

@ -35,9 +35,6 @@ if T.TYPE_CHECKING:
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]]
TV_func = T.TypeVar('TV_func', bound=T.Callable[..., T.Any])

@ -142,22 +142,6 @@ def typed_operator(operator: MesonOperator,
return T.cast('_TV_FN_Operator', wrapper)
return inner
def unary_operator(operator: MesonOperator) -> T.Callable[['_TV_FN_Operator'], '_TV_FN_Operator']:
"""Decorator that does type checking for unary operator calls.
This decorator is for unary operators that do not take any other objects.
It should be impossible for a user to accidentally break this. Triggering
this check always indicates a bug in the Meson interpreter.
"""
def inner(f: '_TV_FN_Operator') -> '_TV_FN_Operator':
@wraps(f)
def wrapper(self: 'InterpreterObject', other: TYPE_var) -> TYPE_var:
if other is not None:
raise mesonlib.MesonBugException(f'The unary operator `{operator.value}` of {self.display_name()} was passed the object {other} of type {type(other).__name__}')
return f(self, other)
return T.cast('_TV_FN_Operator', wrapper)
return inner
def typed_pos_args(name: str, *types: T.Union[T.Type, T.Tuple[T.Type, ...]],
varargs: T.Optional[T.Union[T.Type, T.Tuple[T.Type, ...]]] = None,

Loading…
Cancel
Save