-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stubtest
false positive with @type_check_only
subtype
#816
Comments
stubgen
false positive with @type_check_only
subtypestubtest
false positive with @type_check_only
subtype
some of the relevant code: Lines 1098 to 1122 in 0935784
Lines 1564 to 1584 in 0935784
Perhaps this Lines 3498 to 3514 in 0935784
|
Describe the problem
In
scipy.special
there are a lot of "ufuncs", which are callablesnumpy.ufunc
instances that have a bunch of extra attributes, methods, and automatically convert an vectorize the input.But the
numpy.ufunc
annotations are very limited, and not very helpfull when it comes to annotating the ufuncs inscipy.special
.So instead of annotating e.g.
beta: np.ufunc
, I created a private@type_check_only
subtype ofnp.ufunc
, and annotated it to match the type-signatures ofscipy.special.beta
.But running
stubtest
on it, gives the following error:(
scipy.special._ufuncs._UFunc21f
is theufunc
subtype)The error message here isn't very helpful, and I don't see why it shouldn't be allowed. Because such a subtype is basically an intersection of
ufunc
and thebeta
-specific annotations (but in a way that pyright and cringe mypy also understand).See jorenham/scipy-stubs#189 for the gory details.
Maybe I'm missing something, but I tried this a bunch of different ways, and none of them seemed to get rid of this error, so this looks like a false positive to me 🤷🏻.
Gist to reproduce
No response
Severity
annoying but workaround is available
Your Environment
The text was updated successfully, but these errors were encountered: