reports: Balance tolerance can be an int.
This commit is contained in:
parent
a87d4bfc6c
commit
89bbf84347
1 changed files with 4 additions and 4 deletions
|
@ -100,7 +100,7 @@ class Balance(Mapping[str, data.Amount]):
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
source: Iterable[data.Amount]=(),
|
source: Iterable[data.Amount]=(),
|
||||||
tolerance: Optional[Decimal]=None,
|
tolerance: Optional[DecimalCompat]=None,
|
||||||
) -> None:
|
) -> None:
|
||||||
if tolerance is None:
|
if tolerance is None:
|
||||||
tolerance = self.TOLERANCE
|
tolerance = self.TOLERANCE
|
||||||
|
@ -179,12 +179,12 @@ 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, tolerance: Optional[Decimal]=None) -> BalanceType:
|
def copy(self: BalanceType, tolerance: Optional[DecimalCompat]=None) -> BalanceType:
|
||||||
if tolerance is None:
|
if tolerance is None:
|
||||||
tolerance = self.tolerance
|
tolerance = self.tolerance
|
||||||
return type(self)(self.values(), 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:
|
if tolerance is None:
|
||||||
tolerance = self.tolerance
|
tolerance = self.tolerance
|
||||||
return type(self)(
|
return type(self)(
|
||||||
|
@ -218,7 +218,7 @@ class Balance(Mapping[str, data.Amount]):
|
||||||
sep: str=', ',
|
sep: str=', ',
|
||||||
empty: str="Zero balance",
|
empty: str="Zero balance",
|
||||||
zero: Optional[str]=None,
|
zero: Optional[str]=None,
|
||||||
tolerance: Optional[Decimal]=None,
|
tolerance: Optional[DecimalCompat]=None,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Formats the balance as a string with the given parameters
|
"""Formats the balance as a string with the given parameters
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue