You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ERRORCODES.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ The following warnings are currently emitted by default:
40
40
| Y035 | `__all__`, `__match_args__` and `__slots__` in a stub file should always have values, as these special variables in a `.pyi` file have identical semantics in a stub as at runtime. E.g. write `__all__ = ["foo", "bar"]` instead of `__all__: list[str]`.
41
41
| Y036 | Y036 detects common errors in `__exit__` and `__aexit__` methods. For example, the first argument in an `__exit__` method should either be annotated with `object`, `_typeshed.Unused` (a special alias for `object`) or `type[BaseException] \| None`.
42
42
| Y037 | Use PEP 604 syntax instead of `typing(_extensions).Union` and `typing(_extensions).Optional`. E.g. use `str \| int` instead of `Union[str, int]`, and use `str \| None` instead of `Optional[str]`.
43
-
| Y038 | Use `from collections.abc import Set as AbstractSet` instead of `from typing import AbstractSet`.
43
+
| Y038 | Use `from collections.abc import Set as AbstractSet` instead of `from typing import AbstractSet` or `from typing_extensions import AbstractSet`.
44
44
| Y039 | Use `str` instead of `typing.Text`.
45
45
| Y040 | Never explicitly inherit from `object`, as all classes implicitly inherit from `object` in Python 3.
46
46
| Y041 | Y041 detects redundant numeric unions in the context of parameter annotations. For example, PEP 484 specifies that type checkers should allow `int` objects to be passed to a function, even if the function states that it accepts a `float`. As such, `int` is redundant in the union `int \| float` in the context of a parameter annotation. In the same way, `int` is sometimes redundant in the union `int \| complex`, and `float` is sometimes redundant in the union `float \| complex`.
Copy file name to clipboardExpand all lines: tests/imports.pyi
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -147,6 +147,7 @@ from typing_extensions import runtime_checkable # Y023 Use "typing.runtime_chec
147
147
fromcollectionsimportnamedtuple# Y024 Use "typing.NamedTuple" instead of "collections.namedtuple"
148
148
fromcollections.abcimportSet# Y025 Use "from collections.abc import Set as AbstractSet" to avoid confusion with "builtins.set"
149
149
fromtypingimportAbstractSet# Y038 Use "from collections.abc import Set as AbstractSet" instead of "from typing import AbstractSet" (PEP 585 syntax)
150
+
fromtyping_extensionsimportAbstractSet# Y038 Use "from collections.abc import Set as AbstractSet" instead of "from typing_extensions import AbstractSet" (PEP 585 syntax)
150
151
fromtypingimportText# Y039 Use "str" instead of "typing.Text"
151
152
fromtypingimportByteString# Y057 Do not use typing.ByteString, which has unclear semantics and is deprecated
152
153
fromcollections.abcimportByteString# Y057 Do not use collections.abc.ByteString, which has unclear semantics and is deprecated
0 commit comments