MCPcopy Create free account
hub / github.com/ipython/traitlets / compress

Method compress

traitlets/traitlets.py:1470–1480  ·  view source on GitHub ↗

Merges the provided change with the last if possible.

(past_changes: list[Bunch] | None, change: Bunch)

Source from the content-addressed store, hash-verified

1468 cache: dict[str, list[Bunch]] = {}
1469
1470 def compress(past_changes: list[Bunch] | None, change: Bunch) -> list[Bunch]:
1471 """Merges the provided change with the last if possible."""
1472 if past_changes is None:
1473 return [change]
1474 else:
1475 if past_changes[-1]["type"] == "change" and change.type == "change":
1476 past_changes[-1]["new"] = change.new
1477 else:
1478 # In case of changes other than 'change', append the notification.
1479 past_changes.append(change)
1480 return past_changes
1481
1482 def hold(change: Bunch) -> None:
1483 name = change.name

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected