diff options
| author | shadchin <[email protected]> | 2024-03-04 21:16:16 +0300 |
|---|---|---|
| committer | shadchin <[email protected]> | 2024-03-04 21:43:39 +0300 |
| commit | 74819c4157bd388a7d429c870ea4b343a282dafa (patch) | |
| tree | 4bff355b03dfb24b14d33581357cc8e624d170fd /contrib/python/contourpy | |
| parent | f64c28a5443395e3a8f27e6f1b15a3507812d2de (diff) | |
Extend support pyi files
Сейчас pyi файлы в макросе PY_SRCS используются исключительно в Arcadia плагине для продуктов JB, при сборке эти файлы просто игнорируются.
В этом PR добавил шаг, который будет содержимое этих файлов складывать в ресурсы, секция PY_SRCS удобна тем, что позволяет раскладывать pyi файлы с учетом TOP_LEVEL/NAMESPACE, а это необходимо для правильной работы mypy.
3924b0556bc99947e6893cd79e5ce62ec72a18a9
Diffstat (limited to 'contrib/python/contourpy')
| -rw-r--r-- | contrib/python/contourpy/contourpy/_contourpy.pyi | 202 | ||||
| -rw-r--r-- | contrib/python/contourpy/contourpy/util/_build_config.pyi | 5 |
2 files changed, 207 insertions, 0 deletions
diff --git a/contrib/python/contourpy/contourpy/_contourpy.pyi b/contrib/python/contourpy/contourpy/_contourpy.pyi new file mode 100644 index 00000000000..7cbca59023d --- /dev/null +++ b/contrib/python/contourpy/contourpy/_contourpy.pyi @@ -0,0 +1,202 @@ +from __future__ import annotations + +from typing import ClassVar, NoReturn + +import numpy as np +import numpy.typing as npt +from typing_extensions import TypeAlias + +import contourpy._contourpy as cpy + +# Input numpy array types, the same as in common.h +CoordinateArray: TypeAlias = npt.NDArray[np.float64] +MaskArray: TypeAlias = npt.NDArray[np.bool_] + +# Output numpy array types, the same as in common.h +PointArray: TypeAlias = npt.NDArray[np.float64] +CodeArray: TypeAlias = npt.NDArray[np.uint8] +OffsetArray: TypeAlias = npt.NDArray[np.uint32] + +# Types returned from filled() +FillReturn_OuterCode: TypeAlias = tuple[list[PointArray], list[CodeArray]] +FillReturn_OuterOffset: TypeAlias = tuple[list[PointArray], list[OffsetArray]] +FillReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]] +FillReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]] +FillReturn_ChunkCombinedCodeOffset: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None], list[OffsetArray | None]] +FillReturn_ChunkCombinedOffsetOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None], list[OffsetArray | None]] +FillReturn_Chunk: TypeAlias = FillReturn_ChunkCombinedCode | FillReturn_ChunkCombinedOffset | FillReturn_ChunkCombinedCodeOffset | FillReturn_ChunkCombinedOffsetOffset +FillReturn: TypeAlias = FillReturn_OuterCode | FillReturn_OuterOffset | FillReturn_Chunk + +# Types returned from lines() +LineReturn_Separate: TypeAlias = list[PointArray] +LineReturn_SeparateCode: TypeAlias = tuple[list[PointArray], list[CodeArray]] +LineReturn_ChunkCombinedCode: TypeAlias = tuple[list[PointArray | None], list[CodeArray | None]] +LineReturn_ChunkCombinedOffset: TypeAlias = tuple[list[PointArray | None], list[OffsetArray | None]] +LineReturn_ChunkCombinedNan: TypeAlias = tuple[list[PointArray | None]] +LineReturn_Chunk: TypeAlias = LineReturn_ChunkCombinedCode | LineReturn_ChunkCombinedOffset | LineReturn_ChunkCombinedNan +LineReturn: TypeAlias = LineReturn_Separate | LineReturn_SeparateCode | LineReturn_Chunk + + +NDEBUG: int +__version__: str + +class FillType: + ChunkCombinedCode: ClassVar[cpy.FillType] + ChunkCombinedCodeOffset: ClassVar[cpy.FillType] + ChunkCombinedOffset: ClassVar[cpy.FillType] + ChunkCombinedOffsetOffset: ClassVar[cpy.FillType] + OuterCode: ClassVar[cpy.FillType] + OuterOffset: ClassVar[cpy.FillType] + __members__: ClassVar[dict[str, cpy.FillType]] + def __eq__(self, other: object) -> bool: ... + def __getstate__(self) -> int: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __init__(self, value: int) -> None: ... + def __int__(self) -> int: ... + def __ne__(self, other: object) -> bool: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: int) -> NoReturn: ... + @property + def name(self) -> str: ... + @property + def value(self) -> int: ... + +class LineType: + ChunkCombinedCode: ClassVar[cpy.LineType] + ChunkCombinedNan: ClassVar[cpy.LineType] + ChunkCombinedOffset: ClassVar[cpy.LineType] + Separate: ClassVar[cpy.LineType] + SeparateCode: ClassVar[cpy.LineType] + __members__: ClassVar[dict[str, cpy.LineType]] + def __eq__(self, other: object) -> bool: ... + def __getstate__(self) -> int: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __init__(self, value: int) -> None: ... + def __int__(self) -> int: ... + def __ne__(self, other: object) -> bool: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: int) -> NoReturn: ... + @property + def name(self) -> str: ... + @property + def value(self) -> int: ... + +class ZInterp: + Linear: ClassVar[cpy.ZInterp] + Log: ClassVar[cpy.ZInterp] + __members__: ClassVar[dict[str, cpy.ZInterp]] + def __eq__(self, other: object) -> bool: ... + def __getstate__(self) -> int: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __init__(self, value: int) -> None: ... + def __int__(self) -> int: ... + def __ne__(self, other: object) -> bool: ... + def __repr__(self) -> str: ... + def __setstate__(self, state: int) -> NoReturn: ... + @property + def name(self) -> str: ... + @property + def value(self) -> int: ... + +def max_threads() -> int: ... + +class ContourGenerator: + def create_contour(self, level: float) -> LineReturn: ... + def create_filled_contour(self, lower_level: float, upper_level: float) -> FillReturn: ... + def filled(self, lower_level: float, upper_level: float) -> FillReturn: ... + def lines(self, level: float) -> LineReturn: ... + @staticmethod + def supports_corner_mask() -> bool: ... + @staticmethod + def supports_fill_type(fill_type: FillType) -> bool: ... + @staticmethod + def supports_line_type(line_type: LineType) -> bool: ... + @staticmethod + def supports_quad_as_tri() -> bool: ... + @staticmethod + def supports_threads() -> bool: ... + @staticmethod + def supports_z_interp() -> bool: ... + @property + def chunk_count(self) -> tuple[int, int]: ... + @property + def chunk_size(self) -> tuple[int, int]: ... + @property + def corner_mask(self) -> bool: ... + @property + def fill_type(self) -> FillType: ... + @property + def line_type(self) -> LineType: ... + @property + def quad_as_tri(self) -> bool: ... + @property + def thread_count(self) -> int: ... + @property + def z_interp(self) -> ZInterp: ... + default_fill_type: cpy.FillType + default_line_type: cpy.LineType + +class Mpl2005ContourGenerator(ContourGenerator): + def __init__( + self, + x: CoordinateArray, + y: CoordinateArray, + z: CoordinateArray, + mask: MaskArray, + *, + x_chunk_size: int = 0, + y_chunk_size: int = 0, + ) -> None: ... + +class Mpl2014ContourGenerator(ContourGenerator): + def __init__( + self, + x: CoordinateArray, + y: CoordinateArray, + z: CoordinateArray, + mask: MaskArray, + *, + corner_mask: bool, + x_chunk_size: int = 0, + y_chunk_size: int = 0, + ) -> None: ... + +class SerialContourGenerator(ContourGenerator): + def __init__( + self, + x: CoordinateArray, + y: CoordinateArray, + z: CoordinateArray, + mask: MaskArray, + *, + corner_mask: bool, + line_type: LineType, + fill_type: FillType, + quad_as_tri: bool, + z_interp: ZInterp, + x_chunk_size: int = 0, + y_chunk_size: int = 0, + ) -> None: ... + def _write_cache(self) -> NoReturn: ... + +class ThreadedContourGenerator(ContourGenerator): + def __init__( + self, + x: CoordinateArray, + y: CoordinateArray, + z: CoordinateArray, + mask: MaskArray, + *, + corner_mask: bool, + line_type: LineType, + fill_type: FillType, + quad_as_tri: bool, + z_interp: ZInterp, + x_chunk_size: int = 0, + y_chunk_size: int = 0, + thread_count: int = 0, + ) -> None: ... + def _write_cache(self) -> None: ... diff --git a/contrib/python/contourpy/contourpy/util/_build_config.pyi b/contrib/python/contourpy/contourpy/util/_build_config.pyi new file mode 100644 index 00000000000..7ca4b0eb8cd --- /dev/null +++ b/contrib/python/contourpy/contourpy/util/_build_config.pyi @@ -0,0 +1,5 @@ +# Explicit type hints for dynamically-generated python file that mypy may not be able to find. + +from __future__ import annotations + +def build_config() -> dict[str, str]: ... |
