From: Ɓukasz Langa Date: Thu, 22 Mar 2018 01:31:58 +0000 (-0700) Subject: Omit extra space in kwarg unpacking if it's an argument X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/df7aacb43eb16f91adcb558905625d75ee804753?ds=sidebyside Omit extra space in kwarg unpacking if it's an argument Fixes #46 --- diff --git a/README.md b/README.md index aba30ab..91c9384 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,9 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). * don't omit whitespace if the previous factor leaf wasn't a math operator (#55) +* omit extra space in kwarg unpacking if it's the first argument (#46) + + ### 18.3a3 * don't remove single empty lines outside of bracketed expressions diff --git a/black.py b/black.py index 0dd7630..d3e0761 100644 --- a/black.py +++ b/black.py @@ -867,21 +867,22 @@ def whitespace(leaf: Leaf) -> str: # noqa C901 if prevp.type == token.EQUAL: if prevp.parent and prevp.parent.type in { - syms.typedargslist, - syms.varargslist, - syms.parameters, syms.arglist, syms.argument, + syms.parameters, + syms.typedargslist, + syms.varargslist, }: return NO elif prevp.type == token.DOUBLESTAR: if prevp.parent and prevp.parent.type in { - syms.typedargslist, - syms.varargslist, - syms.parameters, syms.arglist, + syms.argument, syms.dictsetmaker, + syms.parameters, + syms.typedargslist, + syms.varargslist, }: return NO diff --git a/tests/expression.py b/tests/expression.py index c18942e..91e5465 100644 --- a/tests/expression.py +++ b/tests/expression.py @@ -75,6 +75,7 @@ call(arg, kwarg='hey') call(arg, another, kwarg='hey', **kwargs) call(this_is_a_very_long_variable_which_will_force_a_delimiter_split, arg, another, kwarg='hey', **kwargs) # note: no trailing comma pre-3.6 call(*gidgets[:2]) +call(**self.screen_kwargs) lukasz.langa.pl call.me(maybe) 1 .real @@ -237,6 +238,7 @@ call( **kwargs ) # note: no trailing comma pre-3.6 call(*gidgets[:2]) +call(**self.screen_kwargs) lukasz.langa.pl call.me(maybe) 1 .real