summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2022-08-03 18:37:35 -0400
committerGitHub <noreply@github.com>2022-08-03 18:37:35 -0400
commitc97e4f86bd60e449a64be6c0de5b5ec5bb28b8e9 (patch)
tree0688aa846178fc76be76f8f0e9114e9a2eebedea
parent9e6e820b269cbe39da854ae2835bd797028d22db (diff)
parent43c5afaeef44a01b512ade340030ff4d7b0ba78e (diff)
downloadpep8-c97e4f86bd60e449a64be6c0de5b5ec5bb28b8e9.tar.gz
Merge pull request #1091 from asottile/E275-yield-expression
allow parenthesized yield (generator-coroutines)
-rwxr-xr-xpycodestyle.py1
-rw-r--r--testsuite/E27.py4
2 files changed, 5 insertions, 0 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index 5c4d5f9..ad3030a 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -495,6 +495,7 @@ def missing_whitespace_after_keyword(logical_line, tokens):
tok0.string not in SINGLETONS and
tok0.string not in ('async', 'await') and
not (tok0.string == 'except' and tok1.string == '*') and
+ not (tok0.string == 'yield' and tok1.string == ')') and
tok1.string not in ':\n'):
yield tok0.end, "E275 missing whitespace after keyword"
diff --git a/testsuite/E27.py b/testsuite/E27.py
index 5b47657..ca06930 100644
--- a/testsuite/E27.py
+++ b/testsuite/E27.py
@@ -52,3 +52,7 @@ matched = {"true": True, "false": False}
#: E275:2:11
if True:
assert(1)
+#: Okay
+def f():
+ print((yield))
+ x = (yield)