typing: Fully annotate dependencies.coarrays

pull/8837/head
Daniel Mensinger 3 years ago
parent e0f62d1812
commit 1d0bd562f1
  1. 10
      mesonbuild/dependencies/coarrays.py
  2. 1
      run_mypy.py

@ -21,15 +21,15 @@ from .pkgconfig import PkgConfigDependency
from .factory import factory_methods
if T.TYPE_CHECKING:
from . base import DependencyType
from . base import Dependency
from ..environment import Environment, MachineChoice
@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE, DependencyMethods.SYSTEM})
def coarray_factory(env: 'Environment', for_machine: 'MachineChoice',
kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List[T.Callable[[], 'Dependency']]:
fcid = detect_compiler('coarray', env, for_machine, 'fortran').get_id()
candidates = [] # type: T.List[DependencyType]
candidates: T.List[T.Callable[[], 'Dependency']] = []
if fcid == 'gcc':
# OpenCoarrays is the most commonly used method for Fortran Coarray with GCC
@ -59,7 +59,7 @@ class CoarrayDependency(ExternalDependency):
Coarrays may be thought of as a high-level language abstraction of
low-level MPI calls.
"""
def __init__(self, environment, kwargs: dict):
def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
super().__init__('coarray', environment, kwargs, language='fortran')
kwargs['required'] = False
kwargs['silent'] = True
@ -84,5 +84,5 @@ class CoarrayDependency(ExternalDependency):
self.is_found = True
@staticmethod
def get_methods():
def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.AUTO, DependencyMethods.CMAKE, DependencyMethods.PKGCONFIG]

@ -19,6 +19,7 @@ modules = [
'mesonbuild/arglist.py',
# 'mesonbuild/coredata.py',
'mesonbuild/dependencies/base.py',
'mesonbuild/dependencies/coarrays.py',
'mesonbuild/dependencies/boost.py',
'mesonbuild/dependencies/hdf5.py',
'mesonbuild/dependencies/mpi.py',

Loading…
Cancel
Save