23.11.0
New error codes:
- Y058: Use
Iteratorrather thanGeneratoras the return value for simple__iter__methods, andAsyncIteratorrather thanAsyncGeneratoras 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
Noneinside aLiteral[]slice. For example, useLiteral["foo"] | Noneinstead ofLiteral["foo", None].
Other changes:
- The undocumented
pyi.__version__andpyi.PyiTreeChecker.versionattributes has been removed. Useflake8 --versionfrom the command line, orimportlib.metadata.version("flake8_pyi")at runtime, to determine the version offlake8-pyiinstalled at runtime. - Y038 now flags
from typing_extensions import AbstractSetas well asfrom 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.ABCMetaand/orenum.EnumMeta. Classes that have one or more of these as bases are metaclasses, and PEP 673 forbids the use oftyping(_extensions).Selffor 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.Textnow causes Y039 to be emitted rather than Y023. - Y053 will no longer be emitted for the argument to
@typing_extensions.deprecated.