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

typing.no_type_check decorator is not being considered #595

Open
liiight opened this issue Nov 28, 2020 · 2 comments
Open

typing.no_type_check decorator is not being considered #595

liiight opened this issue Nov 28, 2020 · 2 comments

Comments

@liiight
Copy link

liiight commented Nov 28, 2020

pyflakes does not seem to take into consideration the typing.no_type_check decorator and throws F821 undefined name error,
Example (from Uplink's documentation, a great library with a custom use case for type annotation):

from uplink import Consumer, get, Path, Query
from typing import no_type_check


class GitHub(Consumer):
    """A Python Client for the GitHub API."""
    @get("users/{user}/repos")
    @no_type_check
    def get_repos(self, user: Path, sort_by: Query("sort")):
        """Get user's public repositories."""

Results of running pyflakes:

➜ pyflakes flake8_poc.py
flake8_poc.py:9:52 undefined name 'sort'

This raises no error when running using mypy for example.

@sigmavirus24
Copy link
Member

This is sort of a duplicate of #554. That Query annotation, as was already explained on Flake8's issue tracker, isn't valid PEP 484

@asottile
Copy link
Member

we should still support this decorator I think, it's similar to the support for Annotation and there's already a context for disabling type annotation considering in pyflakes

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

3 participants