From 52fa66bba1e8795d75aa53b943a0b8d7049181a8 2020-05-28 13:01:00 From: Brett Smith Date: 2020-05-28 13:01:00 Subject: [PATCH] data: Specify the type of Posting.cost. The rationale is the same as it was for Posting.amount. --- diff --git a/conservancy_beancount/data.py b/conservancy_beancount/data.py index ff865242e24d4d1ae76669cb047228cc84c50d6f..b076977fda3ff42f20495df04dbeed810cb15917 100644 --- a/conservancy_beancount/data.py +++ b/conservancy_beancount/data.py @@ -27,6 +27,7 @@ import functools from beancount.core import account as bc_account from beancount.core import amount as bc_amount from beancount.core import convert as bc_convert +from beancount.core import position as bc_position from typing import ( cast, @@ -269,6 +270,7 @@ class Posting(BasePosting): account: Account units: Amount + cost: Optional[bc_position.Cost] # mypy correctly complains that our MutableMapping is not compatible # with Beancount's meta type declaration of Optional[Dict]. IMO # Beancount's type declaration is a smidge too specific: I think its type