X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/df7aacb43eb16f91adcb558905625d75ee804753..584d51a042e7ae437491d5f4cecee73fba14ab37:/black.py?ds=sidebyside diff --git a/black.py b/black.py index d3e0761..877b632 100644 --- a/black.py +++ b/black.py @@ -510,10 +510,16 @@ class Line: ): return False - if closing.type == token.RSQB or closing.type == token.RBRACE: + if closing.type == token.RBRACE: self.leaves.pop() return True + if closing.type == token.RSQB: + comma = self.leaves[-1] + if comma.parent and comma.parent.type == syms.listmaker: + self.leaves.pop() + return True + # For parens let's check if it's safe to remove the comma. If the # trailing one is the only one, we might mistakenly change a tuple # into a different type by removing the comma.