Skip to content

typing.no_type_check_decorator is not stubbed in typeshed #2884

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

Closed
lunixbochs opened this issue Mar 22, 2019 · 4 comments
Closed

typing.no_type_check_decorator is not stubbed in typeshed #2884

lunixbochs opened this issue Mar 22, 2019 · 4 comments
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module

Comments

@lunixbochs
Copy link
Contributor

https://docs.python.org/3/library/typing.html#typing.no_type_check_decorator

I assume this also needs mypy support, as no_type_check is hardcoded there, but including in typeshed feels like a prereq.

from typing import no_type_check, no_type_check_decorator

@no_type_check_decorator
def test(fn):
    return fn

@test
def blah(x: {'x': 1}):
    pass

@no_type_check
def blah2(x: {'x': 1}):
    pass
$ mypy notypecheck.py 
notypecheck.py:1: error: Module 'typing' has no attribute 'no_type_check_decorator'
notypecheck.py:8: error: Invalid type comment or annotation
@JelleZijlstra
Copy link
Member

Yes, we should add it to typeshed. You are right though that type checkers like mypy will need to do additional work in order to make this decorator actually work.

@lunixbochs
Copy link
Contributor Author

Is this just going to be no_type_check_decorator = object() and the type checker is expected to short circuit it internally?

@JelleZijlstra
Copy link
Member

I'd prefer if we make it closer to its runtime implementation, which I think would be something like:

_C = TypeVar("_C", bound=Callable[..., Any])

def no_type_check_decorator(decorator: _C) -> _C: ...

@srittau srittau added size-small stubs: incomplete Annotations or sub-modules missing from an existing package or module labels Jun 5, 2019
lunixbochs added a commit to lunixbochs/typeshed that referenced this issue Nov 12, 2019
lunixbochs added a commit to lunixbochs/typeshed that referenced this issue Nov 17, 2019
@CraftSpider
Copy link
Contributor

This was added in #3460

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module
Projects
None yet
Development

No branches or pull requests

4 participants