reports: Balance tolerance can be an int.

This commit is contained in:
Brett Smith 2020-08-17 10:33:14 -04:00
parent a87d4bfc6c
commit 89bbf84347

View file

@ -100,7 +100,7 @@ class Balance(Mapping[str, data.Amount]):
def __init__(self,
source: Iterable[data.Amount]=(),
tolerance: Optional[Decimal]=None,
tolerance: Optional[DecimalCompat]=None,
) -> None:
if tolerance is None:
tolerance = self.TOLERANCE
@ -179,12 +179,12 @@ class Balance(Mapping[str, data.Amount]):
) -> bool:
return all(op_func(amt.number, operand) for amt in self.values())
def copy(self: BalanceType, tolerance: Optional[Decimal]=None) -> BalanceType:
def copy(self: BalanceType, tolerance: Optional[DecimalCompat]=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:
def clean_copy(self: BalanceType, tolerance: Optional[DecimalCompat]=None) -> BalanceType:
if tolerance is None:
tolerance = self.tolerance
return type(self)(
@ -218,7 +218,7 @@ class Balance(Mapping[str, data.Amount]):
sep: str=', ',
empty: str="Zero balance",
zero: Optional[str]=None,
tolerance: Optional[Decimal]=None,
tolerance: Optional[DecimalCompat]=None,
) -> str:
"""Formats the balance as a string with the given parameters