-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: more fine-grained allowlist #13703
Comments
Yup: Line 108 in 0a720ed
|
@twoertwein While stubtest should do something like this, it might be a little finnicky to get right. I assume your use case for this is to ignore errors from The following patch should work and passes all the tests in
|
Wow, that would cover many cases! Are there other tools except for stubtest that benefit from exposing the "correct"/intended function signature? |
I'm sure there are several, but the only one I'm aware of that I use regularly of is the |
It will also affect the signature displayed by |
A not thought-through idea: Would it make sense for stubtest to operate in two steps: 1) Generate pyi files based on runtime inspection and 2) then "somehow" re-use mypy/pyright to compare those new pyi files with existing pyi files. A probably very ugly way to define "somehow": For each class/function present in both pyi files, create a new python files with: from manual_stubs import Class as Class_manual
from stubtest_stubs import Class as Class_stubtest
class Class(Class_manual, Class_stubtest): ...
from manual_stubs import fun as fun_manual
from stubtest_stubs import fun as fun_stubtest
def fun_a(fun: <signature from fun_manual>): ...
def fun_b(fun: <signature from fun_stubtest>): ...
fun_a(fun_stubtest)
fun_b(fun_manual) then run mypy (or any other type checkers) on this file. |
Feature
A function such as
pandas.read_csv
has many arguments - there are many ways in which a stub file can be incompatible with the implementation :) As far as I know, stubtest's allowlist can either ignore the entire function/method but not individual arguments or individual error codes.Pitch
The allowlist could support which argument names should be ignored. Further, it would be great if stubtest defines error codes/categories to ignore only those categories for a function/argument
The text was updated successfully, but these errors were encountered: