When I run pyrefly report --public-only --prefer-stubs=true numpy on the numpy 2.4.x branch, then for the following stubs definition (src):
class AxisError(ValueError, IndexError):
__slots__ = "_msg", "axis", "ndim"
axis: int | None
ndim: int | None
@overload
def __init__(self, axis: str, ndim: None = None, msg_prefix: None = None) -> None: ...
@overload
def __init__(self, axis: int, ndim: int, msg_prefix: str | None = None) -> None: ...
it reports
{
"kind": "attr",
"name": "numpy.exceptions.AxisError.axis",
"n_typable": 1,
"n_typed": 0,
"n_any": 0,
"n_untyped": 1,
"location": {
"line": 179,
"column": 18
}
},
{
"kind": "attr",
"name": "numpy.exceptions.AxisError.ndim",
"n_typable": 1,
"n_typed": 0,
"n_any": 0,
"n_untyped": 1,
"location": {
"line": 180,
"column": 18
}
},
{
"kind": "function",
"name": "numpy.exceptions.AxisError.__init__",
"n_typable": 4,
"n_typed": 4,
"n_any": 0,
"n_untyped": 0,
"location": {
"line": 24,
"column": 5
}
},
{
"kind": "function",
"name": "numpy.exceptions.AxisError.__str__",
"n_typable": 0,
"n_typed": 0,
"n_any": 0,
"n_untyped": 0,
"location": {
"line": 186,
"column": 5
}
},
{
"kind": "class",
"name": "numpy.exceptions.AxisError",
"n_typable": 0,
"n_typed": 0,
"n_any": 0,
"n_untyped": 0,
"location": {
"line": 19,
"column": 1
}
},
Even though, clearly, the axis and ndim are fully typed.
It's also kinda strange that __str__ is reported here, btw.
When I run
pyrefly report --public-only --prefer-stubs=true numpyon the numpy 2.4.x branch, then for the following stubs definition (src):it reports
{ "kind": "attr", "name": "numpy.exceptions.AxisError.axis", "n_typable": 1, "n_typed": 0, "n_any": 0, "n_untyped": 1, "location": { "line": 179, "column": 18 } }, { "kind": "attr", "name": "numpy.exceptions.AxisError.ndim", "n_typable": 1, "n_typed": 0, "n_any": 0, "n_untyped": 1, "location": { "line": 180, "column": 18 } }, { "kind": "function", "name": "numpy.exceptions.AxisError.__init__", "n_typable": 4, "n_typed": 4, "n_any": 0, "n_untyped": 0, "location": { "line": 24, "column": 5 } }, { "kind": "function", "name": "numpy.exceptions.AxisError.__str__", "n_typable": 0, "n_typed": 0, "n_any": 0, "n_untyped": 0, "location": { "line": 186, "column": 5 } }, { "kind": "class", "name": "numpy.exceptions.AxisError", "n_typable": 0, "n_typed": 0, "n_any": 0, "n_untyped": 0, "location": { "line": 19, "column": 1 } },Even though, clearly, the
axisandndimare fully typed.It's also kinda strange that
__str__is reported here, btw.