From 536f783a826c1b91e6e1e17380083438c3364efc Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 6 Apr 2022 17:24:02 +0100 Subject: [PATCH] Exclude Y037 in `.flake8` config, for now (#7600) Unblocks https://github.com/PyCQA/flake8-pyi/pull/202 --- .flake8 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 44ce3a0d2..3b8915458 100644 --- a/.flake8 +++ b/.flake8 @@ -25,16 +25,19 @@ # Y034 Detect common errors where certain methods are annotated as having a fixed # return type, despite returning self at runtime (temporarily disabled for # typing.pyi, enabled elsewhere). +# Y037 Use PEP 604 syntax instead of `typing.Union` and `typing.Optional`. +# Currently can't be enabled due to a few lingering bugs in mypy regarding +# PEP 604 type aliases (see #4819). [flake8] per-file-ignores = *.py: E203, E501 - *.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026 + *.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y037 # Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload. # 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 '...' - stubs/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027 - stdlib/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026, Y034 + stubs/*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y026, Y027, Y037 + stdlib/typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y026, Y034, Y037 exclude = .venv*,.git,*_pb2.pyi,stdlib/@python2/*