Skip to content
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

How to update stubs ? #1798

Closed
Erhie opened this issue Sep 10, 2021 · 2 comments
Closed

How to update stubs ? #1798

Erhie opened this issue Sep 10, 2021 · 2 comments

Comments

@Erhie
Copy link

Erhie commented Sep 10, 2021

Please tell me, how to update stubs in .pyi files.

I have a problem with the modul Piilow.

The code in Image .pyi has the prototype
def fromarray(obj, mode: _Mode | None = ...) -> Image: ...
and _Mode is defined as
_Mode = Literal["1", "CMYK", "F", "HSV", "I", "L", "LAB", "P", "RGB", "RGBA", "RGBX", "YCbCr"]
But the function fromarray awaits the type str for mode.

Thank you for your answer
Erhy

@jakebailey
Copy link
Member

These stubs are from typeshed: https://github.com/python/typeshed

IIRC the intent is that these are the only valid inputs to mode-like parameters, hence it being a literal set of values. Having written a good bulk of PIL stubs, they do document a specific list of values.

If you think that the types are wrong, I would suggest filing an issue on typeshed to discuss it.

@Erhie
Copy link
Author

Erhie commented Sep 11, 2021

Now I had success by uninstall and newly installed Pillow and
purge in ....vscode\extensions\ms-python.vscode-pylance-2021.9.1\dist\typeshed-fallback\stubs\Pillow
and now there is no warning for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants