diff --git a/.flake8 b/.flake8 index e0862778a..4c8e737b8 100644 --- a/.flake8 +++ b/.flake8 @@ -19,6 +19,9 @@ # Rules that we'd like to enable in the future: # Y026 Use typing_extensions.TypeAlias for type aliases (blocked by #4913) +# Y027 Disallow importing typing.ContextManager, typing.OrderedDict & +# typing_extensions.OrderedDict (cannot be globally enabled while typeshed +# still contains stubs supporting Python 2). [flake8] per-file-ignores = @@ -28,7 +31,10 @@ per-file-ignores = # Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself. # https://github.com/PyCQA/flake8/issues/1079 # F811 redefinition of unused '...' - typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026 + stubs/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027 + stdlib/@python2/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027 + stdlib/@python2/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026, Y027 + stdlib/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026 # We are checking with Python 3 but many of the stubs are Python 2 stubs. builtins = buffer,file,long,raw_input,unicode,xrange diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 047285d89..9164227fa 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import Self, StrOrBytesPath from types import TracebackType -from typing import ( +from typing import ( # noqa Y027 IO, Any, AsyncGenerator,