From ae974b8e50c01ef543ada549bd90c78c95c802e8 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Thu, 18 Jun 2020 14:06:18 -0400 Subject: [PATCH] reports: Balance.copy() accepts tolerance argument. --- conservancy_beancount/reports/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conservancy_beancount/reports/core.py b/conservancy_beancount/reports/core.py index 5e27169..7f93368 100644 --- a/conservancy_beancount/reports/core.py +++ b/conservancy_beancount/reports/core.py @@ -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: