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

Parse complex expressions in parameters after * and **
authorZsolt Dollenstein <zsol.zsol@gmail.com>
Tue, 17 Apr 2018 08:04:35 +0000 (09:04 +0100)
committerZsolt Dollenstein <zsol.zsol@gmail.com>
Tue, 17 Apr 2018 19:34:02 +0000 (20:34 +0100)
black.py
blib2to3/Grammar.txt
blib2to3/Grammar3.6.5.final.0.pickle
tests/expression.diff
tests/expression.py

index c3610c74b12a43ecf654a9e08cadaa3cc8f9a5f7..7c487f6e938c1b8113674b10bc91877da0546aa3 100644 (file)
--- a/black.py
+++ b/black.py
@@ -1364,7 +1364,7 @@ def whitespace(leaf: Leaf) -> str:  # noqa C901
             if not prevp or prevp.type == token.LPAR:
                 return NO
 
-        elif prev.type == token.EQUAL or prev.type == token.DOUBLESTAR:
+        elif prev.type in {token.EQUAL, token.STAR, token.DOUBLESTAR}:
             return NO
 
     elif p.type == syms.decorator:
index 4905c91e635e8a40a10b255258db4c96a303a56f..c9cb3a7e8c9bfe159684f3e23afaad8a2cb9a2d0 100644 (file)
@@ -138,8 +138,8 @@ arglist: argument (',' argument)* [',']
 # that precede iterable unpackings are blocked; etc.
 argument: ( test [comp_for] |
             test '=' test |
-           '**' expr |
-           star_expr )
+           '**' test |
+            '*' test )
 
 comp_iter: comp_for | comp_if
 comp_for: [ASYNC] 'for' exprlist 'in' or_test [comp_iter]
index 3a8d93d064336eeef658656eb2916ca35a9089ca..e9d5fabf717b9731ad6cd3524b4d09419a08cd78 100644 (file)
Binary files a/blib2to3/Grammar3.6.5.final.0.pickle and b/blib2to3/Grammar3.6.5.final.0.pickle differ
index bc34c0ed496e4f289d7f468be5fef61eccd9b85e..dd9459c4453593e8ab186ba2c51c6720740d6888 100644 (file)
  ]
  slice[0]
  slice[0:1]
-@@ -121,85 +135,119 @@
+@@ -121,88 +135,122 @@
  numpy[-(c + 1):, d]
  numpy[:, l[-2]]
  numpy[:, ::-1]
  
  async def f():
      await some.complicated[0].call(with_args=(True or (1 is not 1)))
+-print(* [] or [1])
++
++
++print(*[] or [1])
+ print(**{1: 3} if False else {x: x for x in range(3)})
+-print(* lambda x: x)
 -for x, in (1,), (2,), (3,): ...
 -for y in (): ...
 -for z in (i for i in (1, 2, 3)): ...
 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 -):
 -    return True
-+
-+
++print(*lambda x: x)
 +for (x,) in (1,), (2,), (3,):
 +    ...
 +for y in ():
index 9c071771f7676ba528d5f98c480e874f759f99a5..2ecf5223374972a54d3a71bcf754774eb83ec733 100644 (file)
@@ -158,6 +158,9 @@ def gen():
 
 async def f():
     await some.complicated[0].call(with_args=(True or (1 is not 1)))
+print(* [] or [1])
+print(**{1: 3} if False else {x: x for x in range(3)})
+print(* lambda x: x)
 for x, in (1,), (2,), (3,): ...
 for y in (): ...
 for z in (i for i in (1, 2, 3)): ...
@@ -402,6 +405,9 @@ async def f():
     await some.complicated[0].call(with_args=(True or (1 is not 1)))
 
 
+print(*[] or [1])
+print(**{1: 3} if False else {x: x for x in range(3)})
+print(*lambda x: x)
 for (x,) in (1,), (2,), (3,):
     ...
 for y in ():