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

Function _hook

numpy/typing/mypy_plugin.py:119–124  ·  view source on GitHub ↗

Replace a type-alias with a concrete ``NBitBase`` subclass.

(ctx: AnalyzeTypeContext)

Source from the content-addressed store, hash-verified

117
118
119def _hook(ctx: AnalyzeTypeContext) -> Type:
120 """Replace a type-alias with a concrete ``NBitBase`` subclass."""
121 typ, _, api = ctx
122 name = typ.name.split(".")[-1]
123 name_new = _PRECISION_DICT[f"numpy._typing._nbit.{name}"]
124 return api.named_type(name_new)
125
126
127if TYPE_CHECKING or MYPY_EX is None:

Callers

nothing calls this directly

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected