Changeset - 355a48381cbc
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-06-18 18:05:49
brettcsmith@brettcsmith.org
reports: Balance.clean_copy() creates new Balance with given tolerance.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/core.py
Show inline comments
...
 
@@ -171,14 +171,14 @@ class Balance(Mapping[str, data.Amount]):
 
        return type(self)(self.values())
 

	
 
    def clean_copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
 
        if tolerance is None:
 
            tolerance = self.tolerance
 
        return type(self)(
 
            amount for amount in self.values()
 
            if abs(amount.number) >= tolerance
 
            (amount for amount in self.values() if abs(amount.number) >= tolerance),
 
            tolerance,
 
        )
 

	
 
    @staticmethod
 
    def within_tolerance(dec: DecimalCompat, tolerance: DecimalCompat) -> bool:
 
        dec = cast(Decimal, dec)
 
        return abs(dec) < tolerance
0 comments (0 inline, 0 general)