summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Release 2.3.0 (#608)2.3.0Anthony Sottile2021-03-142-1/+13
|
* Fix: Named types incorrectly raising UndefinedName inside annotated ↵Léni2021-03-142-12/+104
| | | | subscript (#609)
* Fix annotation clobbering __all__ (#606)Anthony Sottile2021-01-052-1/+17
|
* deterministic ordering for errors in __all__ (#604)Anthony Sottile2021-01-041-1/+4
|
* Fix quoted type annotations in typing.TypeVar contexts (#534)Ran Benita2021-01-042-0/+28
| | | | TypeVar has such contexts in the positional arguments (for constraints) and in the `bound` keyword argument.
* Test PyPy2/3 on GHA (#598)Hugo van Kemenade2020-12-071-3/+0
|
* Test on GitHub Actions (#596)Hugo van Kemenade2020-12-034-45/+41
| | | | | | | | | | | | | | | | | * Test on GitHub Actions * Add 2.7 and 3.5 to GHA * Remove Travis CI and AppVeyor * Simplify config Co-authored-by: Anthony Sottile <asottile@umich.edu> * Review updates * Remove redundant line Co-authored-by: Anthony Sottile <asottile@umich.edu>
* Recognize __qualname__ when used in class scope (#588)Pilou2020-10-122-1/+22
| | | Relates #259.
* simplify typing.Literal check (#587)Anthony Sottile2020-10-031-6/+2
|
* Fix tests with Python 3.9, closes #549 (#586)Louis Sautier2020-10-022-8/+7
| | | Stop allowing failures on Python nightly.
* Fix test_invalidEscape with recent PyPy3 versions, closes #584 (#585)Louis Sautier2020-10-024-27/+23
| | | | | | | * Fix test_invalidEscape with recent PyPy3 versions, closes #584 * CI: update PyPY version in Travis and AppVeyor Also make it easier to update for AppVeyor.
* fix: don't return syntax error for Annotated's metadata (#580)Sebastian Kreft2020-09-282-9/+71
| | | | | | | | | | | | | | | | | | | | | | | * fix: don't return syntax error for Annotated's metadata PEP 593 https://www.python.org/dev/peps/pep-0593/ introduced the type Annotated, which allows to add metadata to types. By the definition only the first argument is required to be a proper type, all the other arguments are dependent on the consumer and can be other types or even literals. This PR fixes #574. * fix whitespace * fix tests and formatting * PR comments from asottile * fix _in_annotation and remove _in_typing_annotated field * fix test name * get rid of _exit_annotation in favor of _entger_annotation(AnnotationState.None) * handle Annotated in python3.9+ Co-authored-by: Anthony Sottile <asottile@umich.edu>
* Fix undefined name in annotations (#535)Sebastian Rittau2020-09-282-13/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix undefined name in annotations Variable annotations without a value don't create a name, but they still can be used as variable annotation themselves as long as the annotation is quoted or "from __future__ import annotations" is used. The implementation introduces a new binding "Annotation" for these kinds of variable annotations. This can potentially be used for further annotation-related checks in the future. Annotation handling is extended to be able to detect both forms of postponed annotations (quoted and future import) during checks. Fixes #486 * Fix wrong tuple syntax * Refactor annotation handling * Introduce AnnotationState "enum" * Pass AnnotationState to _enter_annotation() instead of a "string" flag * Add a test for unused annotations * Add a few more tests for unused variables
* Extend F822 to support tuple concatenation (#544)jack11422020-09-272-5/+14
| | | | | | | * Extend F822 to support tuple concatenation * Add test case * Use camel case
* update pypy download urls (#581)Anthony Sottile2020-09-271-2/+2
|
* List Python 3.8 support (#541)Brett Cannon2020-05-114-2/+5
| | | | | | | | | * Add Python 3.8 to Travis * Add Python 3.8 to Tox * Add Python 3.8 trove classifier * List Python 3.8 as supported in the README
* Add tests demonstrating common use of TYPE_CHECKING guards (#531)Anthony Sottile2020-04-271-0/+44
| | | | | * Add tests demonstrating common use of TYPE_CHECKING guards * Add another example using a runtime guard for Protocol
* Fix test for nightly Python (3.9) (#532)Petter Strandmark2020-04-262-0/+7
| | | | | | | * Fix test for nightly Python (3.9) * allow_failures: true for nightly Co-authored-by: Anthony Sottile <asottile@umich.edu>
* Release 2.2.02.2.0Anthony Sottile2020-04-092-1/+28
|
* Fix pyflakes for removal of ast.Param (#523)Anthony Sottile2020-03-181-3/+5
| | | | | * Fix pyflakes for removal of ast.Param * Remove AugStore / AugLoad (not even used in py2)
* Be more cautious when identifying typing Literal (#517)Anthony Sottile2020-03-172-1/+22
|
* Fix quoted type annotations in unusual contexts (#516)Peter Law2020-03-172-13/+102
| | | | | | | | | | | | | | | | | | | | * Extract a context manager for when we're in a annotation context * Detect quoted type annotations within typing.cast calls * Refactor typing name check This will make it easier to detect an unspecified typing module member as well as opening up other checks (such as testing for one of a collection many members all in one go). * Detect quoted annotations within subscripts of typing classes * Add nested quoted test case (Callable) * Use a lambda here for clarity This is slightly more usual than accessing a .__eq__ method and is more obviously similar to the other usage of this helper.
* Deprecate optparse in favor of argparse (#499)sim-d2020-03-171-3/+7
| | | | | * Deprecate optparse in favor of argparse * Support '-V' as an alias for '--version'
* Add a check for if statement conditions which are non-empty tuples (#512)Peter Law2020-03-173-2/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a check for if statement conditions which are non-empty tuples With the increasing prevalence of wrapping conditionals like: if ( some_value != 'some_condition' and other_value is not 42 ) and for wrapping other constructs with trailing commas, like: x = ( some_value, other_value, ) it becomes quite easy to accidentally combine these into a conditional statement which is actually always true: if ( some_value != 'some_condition' and other_value is not 42, ) This commit introduces a check for such constructs. * Make this error message make sense * Further clarity this message's docstring Co-Authored-By: Ran Benita <ran234@gmail.com> Co-authored-by: Ran Benita <ran234@gmail.com>
* Clarify message docstring (#522)Peter Law2020-03-141-1/+1
| | | As commented in https://github.com/PyCQA/pyflakes/pull/512#discussion_r392587730
* Fix bug in async function scope checking (#511)Peter Law2020-03-132-2/+8
| | | | | | | | | | | | | | * Fix bug in async function scope checking Previously attempting to check an async function scoped tree would immediately error because tuples are not callable. The test added here is a direct copy of 'test_scope_function' as I'm not sure what (if anything) should specifically be tested for async functions, though it serves to prove the fix. * Skip async function test where it doesn't apply * Clarify that this is a smoke test for async function segments
* Warn about is comparison to tuple (#484)Anthony Sottile2020-02-173-7/+74
|
* Fix false positive with partially quoted annotations (#479)Anthony Sottile2020-02-142-19/+144
|
* Make pyflakes more resistant to syntax additions (#490)Anthony Sottile2020-02-072-1/+20
|
* Fix annotation of posonlyarg (#508)Anthony Sottile2020-01-172-0/+12
|
* Allow continue inside finally in 3.8+ (#476)Batuhan Taşkaya2019-11-032-1/+4
|
* fix test name typo (#478)Florian Dahlitz2019-10-051-1/+1
|
* Allow @overload on async functions as well (#472)Anthony Sottile2019-09-302-1/+21
|
* Support typing_extensions.overload in addition to typing.overload (#466)Michael J. Sullivan2019-09-282-1/+20
| | | They are synonyms and typing_extensions.overloads works on 3.5.1.
* Adjust tests for different SyntaxError offsets for pypy7.1.1 (#468)Anthony Sottile2019-09-284-36/+49
|
* Remove unnecessary `else` (#439)Steven Myint2019-08-121-2/+2
|
* Add support for PEP 572 assignment expressions (#457)Anthony Sottile2019-08-122-1/+10
|
* In PEP 484 type comments, allow text after "# type: ignore" (#455)Michael J. Sullivan2019-08-123-5/+28
| | | | | | | | | | | | | | | | * In PEP 484 type comments, allow text after "# type: ignore" This is to support allowing typecheckers to implement ignores for specific errors, using syntax like `# type: ignore=E1000` or `# type: ignore[type-mismatch` or some such. mypy is about to add support for ignoring specific errors following this design: https://github.com/python/mypy/issues/7239 Support for extra text in type comments was implemented in CPython as https://bugs.python.org/issue36878 and in typed_ast as https://github.com/python/typed_ast/pull/116. * add test back
* Fix RST markup of bullet point list (#459)Peter Cock2019-08-071-0/+1
|
* Shebang detection improvements (#438)Ville Skyttä2019-08-042-4/+29
| | | | | | | | | | | | | | * Recognize python with arguments in shebang * Recognize python with d/m/u suffix in shebang https://www.python.org/dev/peps/pep-3149/#proposal * Recognize python with minor version in shebang * Avoid unnecessary line splitting in shebang search * Add test for python shebang-like not on the first line
* String formatting linting (#443)Anthony Sottile2019-07-303-3/+593
| | | | | | | | * Add lint rule for f-strings without placeholders * Add linting for string.format(...) * Add linting for % formatting
* Use absolute link to change log for PyPI's benefit (#451)Steven Myint2019-07-161-1/+1
| | | This closes #409.
* Namespace pyflakes's node monkeypatches (#444)Anthony Sottile2019-07-161-18/+27
|
* Merge tag '2.1.1'Phil Frost2019-07-132-1/+5
|\ | | | | | | Forgot to push this to master. Whoops.
| * Release 2.1.12.1.1Phil Frost2019-02-282-1/+5
| |
* | Fix NoneType has no attribute parent when handling doctests (#452)Marius Gedminas2019-07-092-1/+12
| | | | | | | | | | | | | | | | Do not define a special `_` name in doctest scope when the global scope already has a `_`. This mirrors the way doctests actually work: the special `_` value is assigned only when a global of that name doesn't already exist. Fixes #421.
* | Fix return annotation is class level variable caused undefined (#448)秋葉2019-07-022-1/+21
| | | | | | | | | | | | * fix annotation is class level variable caused undefined * update skipif condition
* | Add another test for #422 (#433)Markus Unterwaditzer2019-05-041-14/+6
| | | | | | | | | | | | * Add another test for #422 * remove old test
* | Improve @overload detection (#435)Anthony Sottile2019-03-012-8/+52
| | | | | | | | | | | | * Support @overload mixed with other decorators * Detect @overload not just at module scope
* | Include column numbers with all error messages (#426)Aaron Meurer2019-02-091-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Include column numbers with all error messages As long as the node passed to the message has a col_offset, it is included in the message. There is already a precedent of printing the column number for syntax errors. This changes the API slightly, in that if col_offset is not present on the node, the message.col is now -1 instead of 0. Otherwise, there would be no way to distinguish between errors that have no column number and errors with a column number 0. If this doesn't seem like an acceptable change, I can revert it, and either always use 0 as the default, or use a separate attribute to indicate if the message.col is the "real" column number. I haven't yet tested everything, but I'm not even sure if there are any nodes that don't have a col_offset. There don't appear to be any represented in the test suite. * Simplify some code * Make column numbers start at 1 This also reverts an API break. message.col now defaults to 0 again, instead of -1 (0 means there is no column number and so it isn't included in the printed error message). * Revert column number API change It broke a lot of tests. Now, to minimize API changes as much as possible: - The message.col attribute starts at 0, same as the AST col_offset - message.col is also 0 even if col_offset doesn't exist. Note that currently there aren't any nodes represented in the pyflakes test suite that don't have col_offset. Such nodes do exist in the ast module, but it seems unlikely that they would ever result in a message (only expr and stmt nodes have it, so for instance a Module node would not). - The str version of the message starts columns at 1, which is consistent with the existing messages for syntax errors, as well as other tools such as flake8. * Fix flake8 issue Fixes #158 Fixes #425