Flake8-pyi

Latest version: v24.4.1

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

Scan your dependencies

Page 1 of 7

24.4.1

New error codes:
* Y066: When using if/else with `sys.version_info`,
put the code for new Python versions first.

24.4.0

Bugfixes:
* Fix Y026 false positive: allow simple assignment to `None` in class scopes
if the class is known to be an enum class.

24.3.1

New error codes:
* Y064: Use simpler syntax to define final literal types.
For example, use `x: Final = 42` instead of `x: Final[Literal[42]]`
* Y065: Don't use bare `Incomplete` in parameter and return annotations.

Bugfixes:
* Y090: Fix false positive for `tuple[Unpack[Ts]]`.

24.3.0

New error codes:
* Y063: Use [PEP 570 syntax](https://peps.python.org/pep-0570/) to mark
positional-only arguments, rather than
[the older Python 3.7-compatible syntax](https://peps.python.org/pep-0484/#positional-only-arguments)
described in PEP 484.

24.1.0

New error codes:
* Y062: Disallow duplicate elements inside `Literal[]` slices.

Other features:
* Support flake8>=7.0.0
* Y061 is no longer emitted in situations where Y062 would also be emitted.
* Improve error message for Y060.
* Y023 now bans more imports from `typing_extensions` now that typeshed has
dropped support for Python 3.7.

Bugfixes:
* Y016: Fix false positive if a method had positional-only parameters (using
[PEP 570 syntax](https://peps.python.org/pep-0570/) and the first
positional-or-keyword parameter following the positional-only parameters used
a custom TypeVar (see 455).
* Y046: Fix false negative where an unused protocol would not be detected if
the protocol was generic.

23.11.0

New error codes:
* Y058: Use `Iterator` rather than `Generator` as the return value
for simple `__iter__` methods, and `AsyncIterator` rather than
`AsyncGenerator` as the return value for simple `__aiter__` methods.
* Y059: `Generic[]` should always be the last base class, if it is
present in the bases of a class.
* Y060, which flags redundant inheritance from `Generic[]`.
* Y061: Do not use `None` inside a `Literal[]` slice.
For example, use `Literal["foo"] | None` instead of `Literal["foo", None]`.

Other changes:
* The undocumented `pyi.__version__` and `pyi.PyiTreeChecker.version`
attributes has been removed. Use `flake8 --version` from the command line, or
`importlib.metadata.version("flake8_pyi")` at runtime, to determine the
version of `flake8-pyi` installed at runtime.
* Y038 now flags `from typing_extensions import AbstractSet` as well as
`from typing import AbstractSet`.
* Y022 and Y037 now flag more imports from `typing_extensions`.
* Y034 now attempts to avoid flagging methods inside classes that inherit from
`builtins.type`, `abc.ABCMeta` and/or `enum.EnumMeta`. Classes that have one
or more of these as bases are metaclasses, and PEP 673
[forbids the use of `typing(_extensions).Self`](https://peps.python.org/pep-0673/#valid-locations-for-self)
for metaclasses. While reliably determining whether a class is a metaclass in
all cases would be impossible for flake8-pyi, the new heuristics should
reduce the number of false positives from this check.
* Attempting to import `typing_extensions.Text` now causes Y039 to be emitted
rather than Y023.
* Y053 will no longer be emitted for the argument to `typing_extensions.deprecated`.

Page 1 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.