X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/df7aacb43eb16f91adcb558905625d75ee804753..a970a205bcea73672e85468836b477d3262ee75e:/black.py 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.