Releases: PyCQA/flake8-pyi
Releases · PyCQA/flake8-pyi
22.10.0
Bugfixes:
- Do not emit Y020 for empty strings. Y020 concerns "quoted annotations",
but an empty string can never be a quoted annotation. - Add special-casing so that Y020 is not emitted for
__slots__definitions
insideclassblocks. - Expand Y035 to cover
__slots__definitions as well as__match_args__and
__all__definitions. - Expand Y015 so that errors are emitted for assignments to negative numbers.
Other changes:
- Since v22.8.1, flake8-pyi has emitted a
FutureWarningif run with flake8<5,
warning that the plugin would soon become incompatible with flake8<5. Due to
some issues that mean that some users are unable to upgrade to flake8>=5,
however, flake8-pyi no longer intends to remove support for running the
plugin with flake8<5 before Python 3.7 has reached end-of-life. As such, the
FutureWarningis no longer emitted.
22.8.2
New error codes:
- Y047: Detect unused
TypeAliasdeclarations. - Y049: Detect unused
TypedDictdefinitions. - Y050: Prefer
typing_extensions.Neverfor argument annotations over
typing.NoReturn. - Y051: Detect redundant unions between
Literaltypes and builtin supertypes
(e.g.Literal["foo"] | str, orLiteral[5] | int).
Other enhancements:
- Support
mypy_extensions.TypedDict.
22.8.1
- Add support for flake8 >= 5.0.0.
22.8.0
New error codes:
- Y046: Detect unused
Protocols. - Y048: Function bodies should contain exactly one statement.
Bugfixes:
- Improve error message for the case where a function body contains a docstring
and a...orpassstatement.
Other changes:
- Pin required flake8 version to <5.0.0 (flake8-pyi is not currently compatible with flake8 5.0.0).
22.7.0
New error codes:
- Introduce Y041: Ban redundant numeric unions (
int | float,int | complex,
float | complex). - Introduce Y042: Type alias names should use CamelCase rather than snake_case
- Introduce Y043: Ban type aliases from having names ending with an uppercase "T".
- Introduce Y044: Discourage unnecessary
from __future__ import annotationsimport.
Contributed by Torsten Wörtwein. - Introduce Y045: Ban returning
(Async)Iterablefrom__(a)iter__methods.
Other enhancements and behaviour changes:
- Improve error message for Y026 check.
- Expand Y026 check. Since version 22.4.0, this has only emitted an error for
assignments totyping.Literal,typing.Union, and PEP 604 unions. It now also
emits an error for any subscription on the right-hand side of a simple assignment, as
well as for assignments totyping.AnyandNone. - Support
typing_extensions.overloadandtyping_extensions.NamedTuple. - Slightly expand Y034 to cover the case where a class inheriting from
(Async)Iterator
returns(Async)Iterablefrom__(a)iter__. These classes should nearly always return
Selffrom these methods. - Support Python 3.11.
22.5.1
Behaviour changes:
- Relax Y020 check slightly, enabling the idiom
__all__ += ["foo", "bar"]to be used
in a stub file.
22.5.0
Features:
- Introduce Y039: Use
strinstead oftyping.Textfor Python 3 stubs. - Teach the Y036 check that
builtins.object(as well as the unqualifiedobject) is acceptable as an annotation for an__(a)exit__method argument. - Teach the Y029 check to emit errors for
__repr__and__str__methods that returnbuiltins.str(as opposed to the unqualifiedstr). - Introduce Y040: Never explicitly inherit from
objectin Python 3 stubs.
22.4.1
Features:
- Expand Y027 check to prohibit importing any objects from the typing module that are aliases for objects living in
collections.abc(except fortyping.AbstractSet, which is special-cased). - Introduce Y038: Use
from collections.abc import Set as AbstractSetinstead offrom typing import AbstractSet.
Bugfixes:
- Improve inaccurate error messages for Y036.
22.4.0
Features:
- Introduce Y036 (check for badly defined
__exit__and__aexit__methods). - Introduce Y037 (Use PEP 604 syntax instead of
typing.Unionandtyping.Optional).
Contributed by Oleg Höfling.
Behaviour changes:
- Expand Y035 to cover
__match_args__inside class definitions, as well as__all__
in the global scope.
Bugfixes:
- Improve Y026 check (regarding
typing.TypeAlias) to reduce false-positive errors
emitted when the plugin encountered variable aliases in a stub file.
22.3.0
Bugfixes:
- fix bug where incorrect quoted annotations were not detected within
ifblocks
Behaviour changes:
- Add special-casing so that string literals are allowed in the context of
__match_args__assignments inside a class definition. - Add special-casing so that arbitrary values can be assigned to a variable in a stub file if the variable is annotated with
Final.