]> 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:

Fix numpy-style array indexing
authorŁukasz Langa <lukasz@langa.pl>
Fri, 16 Mar 2018 06:39:45 +0000 (23:39 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Fri, 16 Mar 2018 06:39:45 +0000 (23:39 -0700)
Fixes #33

black.py
tests/expression.py

index 51b5b218889975090b41621c9e25ff0ae94c3a54..d011483747546de1b3248dff21a88b52f9ad4649 100644 (file)
--- a/black.py
+++ b/black.py
@@ -960,7 +960,14 @@ def whitespace(leaf: Leaf) -> str:
 
     elif p.type == syms.subscript:
         # indexing
-        if not prev or prev.type == token.COLON:
+        if not prev:
+            assert p.parent is not None, "subscripts are always parented"
+            if p.parent.type == syms.subscriptlist:
+                return SPACE
+
+            return NO
+
+        elif prev.type == token.COLON:
             return NO
 
     elif p.type == syms.atom:
index a3c810ee9f92883ff9248551670a80a9d9a1b3bb..30a20e977045fa7743765cf32df71813fdd6a36f 100644 (file)
@@ -88,6 +88,7 @@ slice[:]
 slice[:-1]
 slice[1:]
 slice[::-1]
+numpy[:, 0:1]
 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
 {'2.7': dead, '3.7': long_live or die_hard}
 {'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
@@ -219,6 +220,7 @@ slice[:]
 slice[:-1]
 slice[1:]
 slice[::-1]
+numpy[:, 0:1]
 (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
 {'2.7': dead, '3.7': long_live or die_hard}
 {'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}