PyCQA / PyCQA/pyflakes

F822 (flake8): Type-only definitions in stubs and __all__

Open
#533 3 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

I am not sure if this is something that should be fixed in pyflakes as it only concerns stub files and is a genuine error in Python files. Please consider:

__all__ = ["foo"]

foo: int

This reports undefined name 'foo' in __all__. This is true at runtime, although this example is still useful for stubs. (flake8 3.7.9, pyflakes 2.1.1)

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 snippet with pyflakes and then trace how all and annotated names are checked. Determine whether stub-file handling should change without suppressing the genuine runtime error in regular Python files; done means the intended case is handled and existing behavior remains covered by tests.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.