You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support disallow_untyped_decorators = false option for 3rd party libraries #9442
Example
pytest decorators are widely used in the testing of Python code. pytest is still untyped for now.
It would be nice to have the possibility to check the typing of own decorators but ignore untyped decorators of some 3rd party libraries.
@gvanrossum There is an example described here, where it suppresses any error messages generated when the codebase tries importing the module.
I would like to use the same approach to suppress error messages, not about all decorators in my module or my package, but to suppress the error messages for all decorators from 3rd party library, but still detect my own untyped decorators.
fromsome_third_party_packageimportdecorator_one# Untypedfrommy_own_libraryimportdecorator_two# Also untyped# No error here@decorator_onedeffoo() ->None: ...
# But report an error here@decorator_twodefbar() ->None: ...
That's not going to be an easy feature to add; I don't even know where to begin.
Reacted by Max Voitko, Yevhenii Hyzyla, Dmitrii Korzhimanov, zephyrrrr and Erick Yellott
Activity
gvanrossum commentedon Sep 15, 2020
You can already specify this flag on a per-module or per-package basis. How is your proposal different?
mvoitko commentedon Sep 16, 2020
@gvanrossum There is an example described here, where it suppresses any error messages generated when the codebase tries importing the module.
I would like to use the same approach to suppress error messages, not about all decorators in my module or my package, but to suppress the error messages for all decorators from 3rd party library, but still detect my own untyped decorators.
gvanrossum commentedon Sep 16, 2020
Oh, so you want something like this:
That's not going to be an easy feature to add; I don't even know where to begin.