|
10 | 10 |
|
11 | 11 | This module contains the API for ICoCo specifications |
12 | 12 | """ |
13 | | - |
| 13 | +from __future__ import annotations |
14 | 14 | from abc import ABC, abstractmethod |
15 | 15 | from enum import Enum |
16 | | -from typing import List, Tuple |
| 16 | +from typing import TYPE_CHECKING, List, Tuple |
17 | 17 |
|
18 | | -# from .utils import MPIComm, medcoupling # type: ignore |
19 | | -from .utils import medcoupling # type: ignore |
20 | 18 | from .exception import NotImplementedMethod |
21 | 19 | from .version import get_icoco_version, get_version_int |
22 | 20 |
|
23 | 21 |
|
| 22 | +if TYPE_CHECKING: # pragma: no cover |
| 23 | + class medcoupling: # pylint: disable=too-few-public-methods, invalid-name |
| 24 | + """dummy class for type hinting""" |
| 25 | + class MEDCouplingFieldDouble: # pylint: disable=too-few-public-methods |
| 26 | + """dummy class for MEDCouplingFieldDouble type hinting""" |
| 27 | + class MEDCouplingFieldInt: # pylint: disable=too-few-public-methods |
| 28 | + """dummy class for MEDCouplingFieldInt type hinting""" |
| 29 | + class MEDCouplingField: # pylint: disable=too-few-public-methods |
| 30 | + """dummy class for MEDCouplingField type hinting""" |
| 31 | + from mpi4py.MPI import Intracomm as MPIComm # type: ignore # pylint: disable=unused-import |
| 32 | + |
| 33 | + |
24 | 34 | ICOCO_VERSION = get_icoco_version() |
25 | 35 | """ICoCo version as 'X.Y'.""" |
26 | 36 | ICOCO_MAJOR_VERSION = int(get_version_int()[0]) |
@@ -115,7 +125,7 @@ def setDataFile(self, datafile: str) -> None: |
115 | 125 | raise NotImplementedMethod(prob=f"{self.__class__.__module__}.{self.__class__.__name__}", |
116 | 126 | method="setDataFile") |
117 | 127 |
|
118 | | - def setMPIComm(self, mpicomm: 'MPIComm') -> None: # noqa: F821 |
| 128 | + def setMPIComm(self, mpicomm: MPIComm) -> None: # noqa: F821 |
119 | 129 | """(Optional) Provide the MPI communicator to be used by the code for parallel computations. |
120 | 130 |
|
121 | 131 | This method must be called before initialize(). The communicator should include all the |
|
0 commit comments