X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/2848e2e1d6527d6031ea020cd991fd73e52c4a0b..154b98579d3904a042fd3e02a9d77a76be63b36c:/black.py diff --git a/black.py b/black.py index 910a0ed..05edf1a 100644 --- a/black.py +++ b/black.py @@ -1480,7 +1480,13 @@ class EmptyLineTracker: lines (two on module-level). """ before, after = self._maybe_empty_lines(current_line) - before -= self.previous_after + before = ( + # Black should not insert empty lines at the beginning + # of the file + 0 + if self.previous_line is None + else before - self.previous_after + ) self.previous_after = after self.previous_line = current_line return before, after @@ -3008,8 +3014,7 @@ def maybe_make_parens_invisible_in_atom(node: LN, parent: LN) -> bool: # make parentheses invisible first.value = "" # type: ignore last.value = "" # type: ignore - if len(node.children) > 1: - maybe_make_parens_invisible_in_atom(node.children[1], parent=parent) + maybe_make_parens_invisible_in_atom(node.children[1], parent=parent) return False return True