PyCQA / PyCQA/pyflakes

`typing.no_type_check` decorator is not being considered

Open
#595 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
190
Avg merge
8m
Merged PRs (30d)
13

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported example with pyflakes and trace how decorator annotations are analyzed, especially the typing.no_type_check case. The change is complete when the example no longer reports F821 for sort while ordinary undefined-name checks remain intact; no implementation files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.