diff options
author | Bill Wendling <isanbard@gmail.com> | 2021-12-25 23:12:34 -0600 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2021-12-25 23:12:34 -0600 |
commit | 373a2b764554aa6b515b435afb57f83505d5ef9b (patch) | |
tree | 7fad1cfbdf9cf02a42588aaff48f7cec54c355c0 | |
parent | 5b75e6fd8791e97a61ae658f8126353f6fee9ae7 (diff) | |
download | yapf-373a2b764554aa6b515b435afb57f83505d5ef9b.tar.gz |
Reformatting.
-rw-r--r-- | yapf/yapflib/reformatter.py | 9 | ||||
-rw-r--r-- | yapftests/subtype_assigner_test.py | 5 |
2 files changed, 6 insertions, 8 deletions
diff --git a/yapf/yapflib/reformatter.py b/yapf/yapflib/reformatter.py index 7242894..b6e6a13 100644 --- a/yapf/yapflib/reformatter.py +++ b/yapf/yapflib/reformatter.py @@ -67,8 +67,8 @@ def Reformat(llines, verify=False, lines=None): if prev_line and prev_line.disable: # Keep the vertical spacing between a disabled and enabled formatting # region. - _RetainRequiredVerticalSpacingBetweenTokens(lline.first, - prev_line.last, lines) + _RetainRequiredVerticalSpacingBetweenTokens(lline.first, prev_line.last, + lines) if any(tok.is_comment for tok in lline.tokens): _RetainVerticalSpacingBeforeComments(lline) @@ -84,7 +84,7 @@ def Reformat(llines, verify=False, lines=None): _EmitLineUnformatted(state) elif _CanPlaceOnSingleLine(lline) and not any(tok.must_break_before - for tok in lline.tokens): + for tok in lline.tokens): # The logical line fits on one line. while state.next_token: state.AddTokenToState(newline=False, dry_run=False) @@ -749,8 +749,7 @@ def _SingleOrMergedLines(lines): next_line = lines[index + 1] for tok in next_line.tokens: lines[index].AppendToken(tok) - if (len(next_line.tokens) == 1 and - next_line.first.is_multiline_string): + if (len(next_line.tokens) == 1 and next_line.first.is_multiline_string): # This may be a multiline shebang. In that case, we want to retain the # formatting. Otherwise, it could mess up the shell script's syntax. lines[index].disable = True diff --git a/yapftests/subtype_assigner_test.py b/yapftests/subtype_assigner_test.py index 7651061..145a96e 100644 --- a/yapftests/subtype_assigner_test.py +++ b/yapftests/subtype_assigner_test.py @@ -172,9 +172,8 @@ class SubtypeAssignerTest(yapf_test_helper.YAPFTest): not a """) llines = yapf_test_helper.ParseAndUnwrap(code) - self._CheckFormatTokenSubtypes(llines, - [[('not', {subtypes.UNARY_OPERATOR}), - ('a', {subtypes.NONE})]]) + self._CheckFormatTokenSubtypes(llines, [[('not', {subtypes.UNARY_OPERATOR}), + ('a', {subtypes.NONE})]]) def testBitwiseOperators(self): code = textwrap.dedent("""\ |