migrate python 3.5 compatible superclass variable annotations to 3.6

As we now require python 3.6, we can declare their types without
initializing them.
pull/9509/head
Eli Schwartz 3 years ago committed by Jussi Pakkanen
parent f36c01ede9
commit 384151c541
  1. 8
      mesonbuild/compilers/compilers.py
  2. 4
      mesonbuild/interpreterbase/decorators.py

@ -479,11 +479,9 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
LINKER_PREFIX = None # type: T.Union[None, str, T.List[str]]
INVOKES_LINKER = True
# TODO: these could be forward declarations once we drop 3.5 support
if T.TYPE_CHECKING:
language = 'unset'
id = ''
warn_args = {} # type: T.Dict[str, T.List[str]]
language: str
id: str
warn_args: T.Dict[str, T.List[str]]
def __init__(self, exelist: T.List[str], version: str,
for_machine: MachineChoice, info: 'MachineInfo',

@ -551,9 +551,7 @@ def typed_kwargs(name: str, *types: KwargInfo) -> T.Callable[..., T.Any]:
class FeatureCheckBase(metaclass=abc.ABCMeta):
"Base class for feature version checks"
# In python 3.6 we can just forward declare this, but in 3.5 we can't
# This will be overwritten by the subclasses by necessity
feature_registry = {} # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
feature_registry: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
def __init__(self, feature_name: str, version: str, extra_message: T.Optional[str] = None):
self.feature_name = feature_name # type: str

Loading…
Cancel
Save