diff options
author | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2019-07-11 15:51:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 15:51:45 -0500 |
commit | 9726e10004e5615c432f126530ee0540b9903f6e (patch) | |
tree | acd72967182f427f6612198e764d27e99a568fa5 | |
parent | 3b258c375c6392b1475a487c0961cf7dbe03f838 (diff) | |
parent | 4fea946aa5b66d4b39ebe52bd91e84b0ed5b5d54 (diff) | |
download | pep8-9726e10004e5615c432f126530ee0540b9903f6e.tar.gz |
Merge pull request #875 from asottile/ellipsis_not_binary_operator
Ellipsis is not a binary operator
-rwxr-xr-x | pycodestyle.py | 5 | ||||
-rw-r--r-- | testsuite/python3.py | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/pycodestyle.py b/pycodestyle.py index ec6b894..4ade087 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -1205,13 +1205,16 @@ def explicit_line_join(logical_line, tokens): parens -= 1 +_SYMBOLIC_OPS = frozenset("()[]{},:.;@=%~") | frozenset(("...",)) + + def _is_binary_operator(token_type, text): is_op_token = token_type == tokenize.OP is_conjunction = text in ['and', 'or'] # NOTE(sigmavirus24): Previously the not_a_symbol check was executed # conditionally. Since it is now *always* executed, text may be # None. In that case we get a TypeError for `text not in str`. - not_a_symbol = text and text not in "()[]{},:.;@=%~" + not_a_symbol = text and text not in _SYMBOLIC_OPS # The % character is strictly speaking a binary operator, but the # common usage seems to be to put it next to the format parameters, # after a line break. diff --git a/testsuite/python3.py b/testsuite/python3.py index be7c58f..709695a 100644 --- a/testsuite/python3.py +++ b/testsuite/python3.py @@ -37,3 +37,10 @@ class Class: def m(self): xs: List[int] = [] + + +# Used to trigger W504 +def f( + x: str = ... +): + ... |