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

Function _index

numpy/typing/mypy_plugin.py:128–134  ·  view source on GitHub ↗

Identify the first ``ImportFrom`` instance the specified `id`.

(iterable: Iterable[Statement], id: str)

Source from the content-addressed store, hash-verified

126
127if TYPE_CHECKING or MYPY_EX is None:
128 def _index(iterable: Iterable[Statement], id: str) -> int:
129 """Identify the first ``ImportFrom`` instance the specified `id`."""
130 for i, value in enumerate(iterable):
131 if getattr(value, "id", None) == id:
132 return i
133 raise ValueError("Failed to identify a `ImportFrom` instance "
134 f"with the following id: {id!r}")
135
136 def _override_imports(
137 file: MypyFile,

Callers 1

_override_importsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected