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 3 of 7

23.4.0

* Update error messages for Y019 and Y034 to recommend using
`typing_extensions.Self` rather than `_typeshed.Self`.

23.3.1

New error codes:
* Y053: Disallow string or bytes literals with length >50 characters.
Previously this rule only applied to parameter default values;
it now applies everywhere.
* Y054: Disallow numeric literals with a string representation >10 characters long.
Previously this rule only applied to parameter default values;
it now applies everywhere.

Other changes:
* Y011/Y014/Y015: Simple container literals (`list`, `dict`, `tuple` and `set`
literals) are now allowed as default values.
* Y052 is now emitted more consistently.
* Some things that used to result in Y011, Y014 or Y015 being emitted
now result in Y053 or Y054 being emitted.

23.3.0

* Y011/Y014/Y015: Allow `math` constants `math.inf`, `math.nan`, `math.e`,
`math.pi`, `math.tau`, and their negatives in default values. Some other
semantically equivalent values, such as `x = inf` (`from math import inf`),
or `x = np.inf` (`import numpy as np`), should be rewritten to `x = math.inf`.
Contributed by [XuehaiPan](https://github.com/XuehaiPan).

23.1.2

* Y011/Y014/Y015: Increase the maximum character length of literal numbers
in default values from 7 to 10, allowing hexadecimal representation of
32-bit integers. Contributed by [Avasam](https://github.com/Avasam).

23.1.1

New error codes:
* Y052: Disallow default values in global or class namespaces where the
assignment does not have a type annotation. Stubs should be explicit about
the type of all variables in the stub; without type annotations, the type
checker is forced to make inferences, which may have unpredictable
consequences. Enum members are excluded from this check, as are various
special assignments such as `__all__` and `__match_args__`.

Other changes:
* Disallow numeric default values where `len(str(default)) > 7`. If a function
has a default value where the string representation is greater than 7
characters, it is likely to be an implementation detail or a constant that
varies depending on the system you're running on, such as `sys.maxsize`.
* Disallow `str` or `bytes` defaults where the default is >50 characters long,
for similar reasons.
* Allow `ast.Attribute` nodes as default values for a small number of special
cases, such as `sys.maxsize` and `sys.executable`.
* Fewer Y020 false positives are now emitted when encountering default values
in stub files.

23.1.0

Bugfixes:
* Do not emit Y020 (quoted annotations) for strings in parameter defaults.
* Fix checking of defaults for functions with positional-only parameters.

Other changes:
* Modify Y036 so that `_typeshed.Unused` is allowed as an annotation for
parameters in `__(a)exit__` methods. Contributed by
[Avasam](https://github.com/Avasam)
* Several changes have been made to error codes relating to imports:
* The Y027 error code has been removed.
* All errors that used to result in Y027 being emitted now result in Y022
being emitted instead.
* Some errors that used to result in Y023 being emitted now result
in Y022 being emitted instead.
* `typing.Match` and `typing.Pattern` have been added to the list of imports
banned by Y022. Use `re.Match` and `re.Pattern` instead.
* flake8-pyi no longer supports stub files that aim to support Python 2. If your
stubs need to support Python 2, pin flake8-pyi to 22.11.0 or lower.
* Y011, Y014 and Y015 have all been significantly relaxed. `None`, `bool`s,
`int`s, `float`s, `complex` numbers, strings and `bytes` are all now allowed
as default values for parameter annotations or assignments.
* Hatchling is now used as the build backend. This should have minimal, if any,
user-facing impact.

Page 3 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.