Remove the trailing comma and moves the comments attached to it.
(self)
| 419 | return self.comments.get(id(leaf), []) |
| 420 | |
| 421 | def remove_trailing_comma(self) -> None: |
| 422 | """Remove the trailing comma and moves the comments attached to it.""" |
| 423 | trailing_comma = self.leaves.pop() |
| 424 | trailing_comma_comments = self.comments.pop(id(trailing_comma), []) |
| 425 | self.comments.setdefault(id(self.leaves[-1]), []).extend( |
| 426 | trailing_comma_comments |
| 427 | ) |
| 428 | |
| 429 | def is_complex_subscript(self, leaf: Leaf) -> bool: |
| 430 | """Return True iff `leaf` is part of a slice with non-trivial exprs.""" |