pyflakes
pyflakes copied to clipboard
A simple program which checks Python source files for errors
... to support e.g. importing `__version__` from an autogenerated submodule. Closes https://github.com/PyCQA/pyflakes/issues/387. I chose to skip all dunders (per https://www.python.org/dev/peps/pep-0008/#module-level-dunder-names), but I can also just special-case `__version__`, whatever you prefer.
It will resolve #428. ```Python a = 1 def test(): a = 2 del a print(a) test() ``` `handleNodeLoad` will always search the name `a` from function scope to module...
This PR finds a problem that has been observed in real code. Consider the following code: ```python from typing import TYPE_CHECKING ... if TYPE_CHECKING from a import A, B from...
pyflakes does some format specifier checks (https://github.com/PyCQA/pyflakes/pull/443), but it isn't able to detect invalid format specifiers. For example ```py f"{x:f.1}" "{x:f.1}".format(x=1) ``` are both wrong (the `f` is supposed to...
Detect Python 3.2 and lower SyntaxError for deleting variable referenced in nested scope.
Hi everyone ! This is my first contribution so the whole code is still pretty new to me. While working on _pydantic_, I encountered a [false positive](https://github.com/samuelcolvin/pydantic/pull/2221/commits/ab57d19cd77230cba041ee855b2a93d03ad40614) and saw there...
pyflakes does not seem to take into consideration the `typing.no_type_check` decorator and throws `F821 undefined name` error, Example (from [Uplink](https://uplink.readthedocs.io/en/stable/)'s documentation, a great library with a custom use case for...
Test code: ```py def t(items): return ['{x}' for x in items] ``` There is a missing `f` prefix which makes the local `x` variable unused, but pyflakes doesn't notice this....
```py def test(): return x ``` gives `test.py:2:12 undefined name 'x'` as expected, but ```py def test(): global x return x ``` gives no warnings.
```python from typing import Dict def test() -> None: class Tree(Dict[str, "Tree"]): def __missing__(self, key: str) -> "Tree": self[key] = Tree() return self[key] ``` ``` /tmp/x.py:4:26 undefined name 'Tree' ```