From 3a07bcc8d84e43e51b8bdd3a91c12e4f4868a438 Mon Sep 17 00:00:00 2001 From: Mehdi Drissi Date: Tue, 10 Jan 2023 20:20:00 -0800 Subject: [PATCH 1/3] Allow default values in stubs. --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 3d2d0193a83a..02fe1e480501 100644 --- a/.flake8 +++ b/.flake8 @@ -26,7 +26,7 @@ [flake8] per-file-ignores = *.py: E203, E301, E302, E305, E501 - *.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y037 + *.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y011, 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 From 299aad3515be63b5f9fe3539b54eb869e966bc7d Mon Sep 17 00:00:00 2001 From: Mehdi Drissi Date: Tue, 10 Jan 2023 23:02:38 -0800 Subject: [PATCH 2/3] Allow attributes to have default value for constants/enums. --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 02fe1e480501..3a94f54f3710 100644 --- a/.flake8 +++ b/.flake8 @@ -26,7 +26,7 @@ [flake8] per-file-ignores = *.py: E203, E301, E302, E305, E501 - *.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y011, Y037 + *.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F822, Y011, Y015, 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 From 4e07ca6461bc412cc8950fbad75274f20326b93c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 11 Jan 2023 14:25:16 +0000 Subject: [PATCH 3/3] Update .flake8 --- .flake8 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 3a94f54f3710..8470e13948ed 100644 --- a/.flake8 +++ b/.flake8 @@ -23,6 +23,10 @@ # Currently can't be enabled due to a few lingering bugs in mypy regarding # PEP 604 type aliases (see #4819). +# Outdated rules in flake8-pyi that should possibly be deprecated altogether: +# Y011 All default values for typed function arguments must be `...` +# Y015 Attribute must not have a default value other than `...` + [flake8] per-file-ignores = *.py: E203, E301, E302, E305, E501 @@ -31,7 +35,7 @@ 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 '...' - stdlib/typing.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y037 + stdlib/typing.pyi: B, E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822, Y011, Y015, Y037 # Generated protobuf files include docstrings *_pb2.pyi: B, E301, E302, E305, E501, E701, Y021, Y026