reports: Balance.copy() accepts tolerance argument.
This commit is contained in:
parent
355a48381c
commit
ae974b8e50
1 changed files with 4 additions and 2 deletions
|
@ -167,8 +167,10 @@ class Balance(Mapping[str, data.Amount]):
|
||||||
) -> bool:
|
) -> bool:
|
||||||
return all(op_func(amt.number, operand) for amt in self.values())
|
return all(op_func(amt.number, operand) for amt in self.values())
|
||||||
|
|
||||||
def copy(self: BalanceType) -> BalanceType:
|
def copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
|
||||||
return type(self)(self.values())
|
if tolerance is None:
|
||||||
|
tolerance = self.tolerance
|
||||||
|
return type(self)(self.values(), tolerance)
|
||||||
|
|
||||||
def clean_copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
|
def clean_copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
|
||||||
if tolerance is None:
|
if tolerance is None:
|
||||||
|
|
Loading…
Reference in a new issue