File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -1269,20 +1269,19 @@ def explicit_line_join(logical_line, tokens):
1269
1269
parens -= 1
1270
1270
1271
1271
1272
+ # The % character is strictly speaking a binary operator, but the
1273
+ # common usage seems to be to put it next to the format parameters,
1274
+ # after a line break.
1272
1275
_SYMBOLIC_OPS = frozenset ("()[]{},:.;@=%~" ) | frozenset (("..." ,))
1273
1276
1274
1277
1275
1278
def _is_binary_operator (token_type , text ):
1276
- is_op_token = token_type == tokenize .OP
1277
- is_conjunction = text in ['and' , 'or' ]
1278
- # NOTE(sigmavirus24): Previously the not_a_symbol check was executed
1279
- # conditionally. Since it is now *always* executed, text may be
1280
- # None. In that case we get a TypeError for `text not in str`.
1281
- not_a_symbol = text and text not in _SYMBOLIC_OPS
1282
- # The % character is strictly speaking a binary operator, but the
1283
- # common usage seems to be to put it next to the format parameters,
1284
- # after a line break.
1285
- return ((is_op_token or is_conjunction ) and not_a_symbol )
1279
+ return (
1280
+ token_type == tokenize .OP or
1281
+ text in {'and' , 'or' }
1282
+ ) and (
1283
+ text not in _SYMBOLIC_OPS
1284
+ )
1286
1285
1287
1286
1288
1287
def _break_around_binary_operators (tokens ):
You can’t perform that action at this time.
0 commit comments