MCPcopy Create free account
hub / github.com/numpy/numpy / get_additional_deps

Method get_additional_deps

numpy/typing/mypy_plugin.py:164–187  ·  view source on GitHub ↗

Handle all import-based overrides. * Import platform-specific extended-precision `numpy.number` subclasses (*e.g.* `numpy.float96`, `numpy.float128` and `numpy.complex256`). * Import the appropriate `ctypes` equivalent to `numpy.intp`.

(
            self, file: MypyFile
        )

Source from the content-addressed store, hash-verified

162 return None
163
164 def get_additional_deps(
165 self, file: MypyFile
166 ) -> list[tuple[int, str, int]]:
167 """Handle all import-based overrides.
168
169 * Import platform-specific extended-precision `numpy.number`
170 subclasses (*e.g.* `numpy.float96`, `numpy.float128` and
171 `numpy.complex256`).
172 * Import the appropriate `ctypes` equivalent to `numpy.intp`.
173
174 """
175 ret = [(PRI_MED, file.fullname, -1)]
176
177 if file.fullname == "numpy":
178 _override_imports(
179 file, "numpy._typing._extended_precision",
180 imports=[(v, v) for v in _EXTENDED_PRECISION_LIST],
181 )
182 elif file.fullname == "numpy.ctypeslib":
183 _override_imports(
184 file, "ctypes",
185 imports=[(_C_INTP, "_c_intp")],
186 )
187 return ret
188
189 def plugin(version: str) -> type[_NumpyPlugin]:
190 """An entry-point for mypy."""

Callers

nothing calls this directly

Calls 1

_override_importsFunction · 0.85

Tested by

no test coverage detected