@@ -21,6 +21,8 @@ from decimal import Decimal
import babel.numbers # type:ignore[import]
from beancount.core import amount as bc_amount
from .. import data
from typing import (
@@ -73,6 +75,11 @@ class Balance(Mapping[str, data.Amount]):
def __str__(self) -> str:
return self.format()
def __abs__(self) -> 'Balance':
return type(self)(
(key, bc_amount.abs(amt)) for key, amt in self.items()
)
def __eq__(self, other: Any) -> bool:
if (self.is_zero()
and isinstance(other, Balance)