Flake8-pyi

Latest version: v24.9.0

Safety actively analyzes 681866 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

22.11.0

Bugfixes:
* Specify encoding when opening files. Prevents `UnicodeDecodeError` on Windows
when the file contains non-CP1252 characters.
Contributed by [Avasam](https://github.com/Avasam).
* Significant changes have been made to the Y041 check. Previously, Y041 flagged
"redundant numeric unions" (e.g. `float | int`, `complex | float` or `complex | int`)
in all contexts outside of type aliases. This was incorrect. PEP 484 only
specifies that type checkers should treat `int` as an implicit subtype of
`float` in the specific context of parameter annotations for functions and
methods. Y041 has therefore been revised to only emit errors on "redundant
numeric unions" in the context of parameter annotations.

Other changes:
* Support running with flake8 v6.

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
inside `class` blocks.
* 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 `FutureWarning` if 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
`FutureWarning` is no longer emitted.

22.8.2

New error codes:
* Y047: Detect unused `TypeAlias` declarations.
* Y049: Detect unused `TypedDict` definitions.
* Y050: Prefer `typing_extensions.Never` for argument annotations over
`typing.NoReturn`.
* Y051: Detect redundant unions between `Literal` types and builtin supertypes
(e.g. `Literal["foo"] | str`, or `Literal[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 `Protocol`s.
* Y048: Function bodies should contain exactly one statement.

Bugfixes:
* Improve error message for the case where a function body contains a docstring
and a `...` or `pass` statement.

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 annotations` import.
Contributed by Torsten Wörtwein.
* Introduce Y045: Ban returning `(Async)Iterable` from `__(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 to `typing.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 to `typing.Any` and `None`.
* Support `typing_extensions.overload` and `typing_extensions.NamedTuple`.
* Slightly expand Y034 to cover the case where a class inheriting from `(Async)Iterator`
returns `(Async)Iterable` from `__(a)iter__`. These classes should nearly always return
`Self` from these methods.
* Support Python 3.11.

Page 4 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.