Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pycodestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions testsuite/python3.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ class Class:

def m(self):
xs: List[int] = []


# Used to trigger W504
def f(
x: str = ...
):
...