]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/trans.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
from black.mode import Feature
from black.nodes import syms, replace_child, parent_type
from black.nodes import is_empty_par, is_empty_lpar, is_empty_rpar
from black.mode import Feature
from black.nodes import syms, replace_child, parent_type
from black.nodes import is_empty_par, is_empty_lpar, is_empty_rpar
-from black.nodes import CLOSING_BRACKETS, STANDALONE_COMMENT
+from black.nodes import OPENING_BRACKETS, CLOSING_BRACKETS, STANDALONE_COMMENT
from black.lines import Line, append_leaves
from black.brackets import BracketMatchError
from black.comments import contains_pragma_comment
from black.lines import Line, append_leaves
from black.brackets import BracketMatchError
from black.comments import contains_pragma_comment
def do_splitter_match(self, line: Line) -> TMatchResult:
LL = line.leaves
def do_splitter_match(self, line: Line) -> TMatchResult:
LL = line.leaves
+ if line.leaves[-1].type in OPENING_BRACKETS:
+ return TErr(
+ "Cannot wrap parens around a line that ends in an opening bracket."
+ )
+
string_idx = (
self._return_match(LL)
or self._else_match(LL)
string_idx = (
self._return_match(LL)
or self._else_match(LL)
right_leaves.pop()
if old_parens_exist:
right_leaves.pop()
if old_parens_exist:
- assert (
- right_leaves and right_leaves[-1].type == token.RPAR
- ), "Apparently, old parentheses do NOT exist?!"
+ assert right_leaves and right_leaves[-1].type == token.RPAR, (
+ "Apparently, old parentheses do NOT exist?!"
+ f" (left_leaves={left_leaves}, right_leaves={right_leaves})"
+ )
old_rpar_leaf = right_leaves.pop()
append_leaves(string_line, line, right_leaves)
old_rpar_leaf = right_leaves.pop()
append_leaves(string_line, line, right_leaves)