INNER CODE UNIT · Python
_budget_failures
MinaProtocol/mina · maintenance/deps/main.py:191
def _budget_failures(current: Mapping[NodeId, Budget], baseline: Baseline) -> list[Failure]:
failures: list[Failure] = []
for node_id in sorted(set(current) | set(baseline.entrypoints)):
now = current.get(node_id)
was = baseline.entrypoints.get(node_id)
if was is None:
# `now` cannot be None here: the id came from one of the two maps.
assert now is not None
failures.append(NewEntrypoint(entrypoint=node_id, budget=now))
continue
if now is None:
failures.append(MissingEntrypoint(entrypoint=node_id))
continue
failures.extend(
BudgetMoved(entrypoint=node_id, metric=metric, was=was.get(metric), now=now.get(metric))
for metric in Metric
if now.get(metric) != was.get(metric)
)