MCPcopy
hub / github.com/psf/black / remove_trailing_comma

Method remove_trailing_comma

src/black/lines.py:421–427  ·  view source on GitHub ↗

Remove the trailing comma and moves the comments attached to it.

(self)

Source from the content-addressed store, hash-verified

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."""

Callers 1

appendMethod · 0.95

Calls 1

popMethod · 0.80

Tested by

no test coverage detected