From 54af68c789b33e206bb9bb9cd36ee5c4db8a43da Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 18 Apr 2022 16:57:48 +0100 Subject: [PATCH] Add a few `# noqa`s to unblock PyCQA/flake8-pyi#213 (#7658) --- stdlib/_collections_abc.pyi | 2 +- stdlib/array.pyi | 4 +++- stdlib/builtins.pyi | 4 +++- stdlib/types.pyi | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/stdlib/_collections_abc.pyi b/stdlib/_collections_abc.pyi index bd8d35641..4c705433b 100644 --- a/stdlib/_collections_abc.pyi +++ b/stdlib/_collections_abc.pyi @@ -1,6 +1,6 @@ import sys from types import MappingProxyType -from typing import ( +from typing import ( # noqa: Y027 AbstractSet as Set, AsyncGenerator as AsyncGenerator, AsyncIterable as AsyncIterable, diff --git a/stdlib/array.pyi b/stdlib/array.pyi index f0cb64cef..d69f02d33 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -1,7 +1,9 @@ import sys from _typeshed import Self from collections.abc import Iterable -from typing import Any, BinaryIO, Generic, MutableSequence, TypeVar, overload + +# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence +from typing import Any, BinaryIO, Generic, MutableSequence, TypeVar, overload # noqa: Y027 from typing_extensions import Literal, SupportsIndex, TypeAlias _IntTypeCode: TypeAlias = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"] diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index e4dd03f14..316bd3af7 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -36,7 +36,9 @@ from collections.abc import ( ) from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper from types import CodeType, TracebackType, _Cell -from typing import ( + +# mypy crashes if any of {ByteString, Sequence, MutableSequence} are imported from collections.abc in builtins.pyi +from typing import ( # noqa: Y027 IO, Any, BinaryIO, diff --git a/stdlib/types.pyi b/stdlib/types.pyi index b2b4e1c74..872ed57a7 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -15,7 +15,9 @@ from collections.abc import ( ) from importlib.abc import _LoaderProtocol from importlib.machinery import ModuleSpec -from typing import Any, ClassVar, Generic, Mapping, TypeVar, overload + +# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping +from typing import Any, ClassVar, Generic, Mapping, TypeVar, overload # noqa: Y027 from typing_extensions import Literal, ParamSpec, final if sys.version_info >= (3, 10):