]> git.madduck.net Git - etc/vim.git/commitdiff

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:

Don't allow indexing to trigger omitting optional parentheses
authorŁukasz Langa <lukasz@langa.pl>
Thu, 17 May 2018 18:52:47 +0000 (11:52 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Fri, 18 May 2018 00:32:43 +0000 (17:32 -0700)
black.py
tests/composition.py

index a1a34685fdadcbaf65982560831c73778de646b8..e8af3f05b944f5b9f50179ce6ae1186f3886f65a 100644 (file)
--- a/black.py
+++ b/black.py
@@ -2064,12 +2064,22 @@ def right_hand_split(
     ):
         omit = {id(closing_bracket), *omit}
         delimiter_count = body.bracket_tracker.delimiter_count_with_priority()
+        first = body.leaves[0]
+        last = body.leaves[-1]
         if (
             delimiter_count == 0
             or delimiter_count == 1
             and (
-                body.leaves[0].type in OPENING_BRACKETS
-                or body.leaves[-1].type in CLOSING_BRACKETS
+                first.type in OPENING_BRACKETS
+                or last.type == token.RPAR
+                or last.type == token.RBRACE
+                or (
+                    # don't use indexing for omitting optional parentheses;
+                    # it looks weird
+                    last.type == token.RSQB
+                    and last.parent
+                    and last.parent.type != syms.trailer
+                )
             )
         ):
             try:
index 4e7f606f242604c70dcadc67028714c4a7a8bfe5..c83db1d44ee33adbec43e904e6be61237252a552 100644 (file)
@@ -32,11 +32,6 @@ class C:
                         # Another
                     ):
                         print(i)
-            if _cfg_target_split > [int(x) for x in cur_target.split(".")]:
-                my_msg = "$MACOSX_DEPLOYMENT_TARGET mismatch: " 'now "%s" but "%s" during configure' % (
-                    cur_target,
-                    _cfg_target,
-                )
 
     def omitting_trailers(self) -> None:
         get_collection(
@@ -48,6 +43,9 @@ class C:
         d[0][1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][
             22
         ]
+        assignment = (
+            some.rather.elaborate.rule() and another.rule.ending_with.index[123]
+        )
 
     def easy_asserts(self) -> None:
         assert {