* Allow the use of `typing_extensions.TypeVar` in stubs.
* `typing_extensions.TypeVar` has the *default* parameter,
which only exists on Python 3.13+ when using `typing.TypeVar`.
* Reduce false positives from Y052 in relation to enum
subclasses.
* Declare support for Python 3.13
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=31
* Y062: Disallow duplicate elements inside `Literal[]` slices.
* 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.
* Y016: Fix false positive if a method had positional-only
parameters (using PEP 570 syntax 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.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=23
* 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]`.
* 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` for metaclasses.
* 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`.
* Introduce Y090, which warns if you have an annotation such as
`tuple[int]` or `Tuple[int]`. These mean "a tuple of length 1,
in which the sole element is of type `int`". This is sometimes
what you want, but more usually you'll want `tuple[int, ...]`,
which means "a tuple of arbitrary (possibly 0) length, in
which all elements are of type `int`".
* Y011 now ignores `sentinel` and `_typeshed.sentinel` in
default values.
* Y011/Y014/Y015: Allow math constants math.inf, math.nan, math.e,
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=21
- Update to 23.6.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.
* 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.
* Y055: Unions of the form type[X] | type[Y] can be simplified to type[X | Y].
* The way in which flake8-pyi modifies pyflakes runs has been improved.
* Introduce Y056: Various type checkers have different levels of support
for method calls on __all__. Use __all__ += ["foo", "bar"] instead,
as this is known to be supported by all major type checkers.
* Support Python 3.12
* Support PEP 695 syntax for declaring type aliases
* Introduce Y057: Do not use typing.ByteString or collections.abc.ByteString.
* flake8-pyi no longer supports being run on Python 3.7.
* flake8-pyi no longer supports being run with flake8 <v6.
OBS-URL: https://build.opensuse.org/request/show/1105894
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=19
environment, running the flake8 process with shell=True and forcing
the PYTHONPATH.
- Update to 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.
- 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:
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=17
- Update to version 22.11.0:
* Bugfixes:
Specify encoding when opening files. Prevents UnicodeDecodeError on Windows when the file contains non-CP1252 characters. Contributed by 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.
OBS-URL: https://build.opensuse.org/request/show/1040478
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=15
- Remove python_module macro definition
- Update to 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.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-flake8-pyi?expand=0&rev=13