Changeset - d9dca2cd686b
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-03-29 19:32:51
brettcsmith@brettcsmith.org
data: Posting.is_payment casts threshold to address typing issue.
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/data.py
Show inline comments
...
 
@@ -27,2 +27,3 @@ from beancount.core import account as bc_account
 
from typing import (
 
    cast,
 
    Iterable,
...
 
@@ -214,2 +215,3 @@ class Posting(BasePosting):
 
    def is_payment(self, threshold: DecimalCompat=0) -> bool:
 
        threshold = cast(decimal.Decimal, threshold)
 
        return (
...
 
@@ -217,6 +219,3 @@ class Posting(BasePosting):
 
            and self.units.number is not None
 
            # mypy says abs returns an object and we can't negate that.
 
            # Since we know threshold is numeric, it seems safe to assume
 
            # the return value of abs is numeric as well.
 
            and self.units.number < -abs(threshold)  # type:ignore[operator]
 
            and self.units.number < -abs(threshold)
 
        )
0 comments (0 inline, 0 general)