reports: Balance.copy() accepts tolerance argument.

This commit is contained in:
Brett Smith 2020-06-18 14:06:18 -04:00
parent 355a48381c
commit ae974b8e50

View file

@ -167,8 +167,10 @@ class Balance(Mapping[str, data.Amount]):
) -> bool:
return all(op_func(amt.number, operand) for amt in self.values())
def copy(self: BalanceType) -> BalanceType:
return type(self)(self.values())
def copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
if tolerance is None:
tolerance = self.tolerance
return type(self)(self.values(), tolerance)
def clean_copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
if tolerance is None: