Skip to content

Commit 2d91280

Browse files
committed
typing hinting for combined_removals
1 parent ddc5af6 commit 2d91280

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

beancount_import/matching.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def search_postings(self,
314314
negate=False) -> Iterable[SearchPosting]:
315315
# Prepare postings for searching
316316
postings_date_currency = collections.defaultdict(list)
317-
317+
318318
for mp in mps:
319319
weight = get_posting_weight(mp.posting)
320320
if weight is None:
@@ -1489,8 +1489,9 @@ def get_combined_transactions(txns: Tuple[Transaction, Transaction],
14891489
for match_sets in itertools.product(*match_groups.values()):
14901490
combined_matches = sum((match_set.matches for match_set in match_sets),
14911491
[]) # type: PostingMatches
1492-
combined_removals = sum((match_set.removals
1493-
for match_set in match_sets), ())
1492+
combined_removals: MatchablePostings = tuple(removal
1493+
for match_set in match_sets
1494+
for removal in match_set.removals)
14941495
if not combined_matches:
14951496
continue
14961497
for m in combined_matches:

beancount_import/source/amazon_invoice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
|
3030
+-> returns Order
3131
"""
32-
from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast
32+
from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast, Type
3333
from abc import ABC, abstractmethod
3434
import collections
3535
import re
@@ -293,7 +293,7 @@ def parse_date(date_str) -> datetime.date:
293293
return dateutil.parser.parse(date_str, parserinfo=Locale_de_DE._parserinfo(dayfirst=True)).date()
294294

295295

296-
LOCALES = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]}
296+
LOCALES: Dict[str, Type[Locale_Data]] = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]}
297297

298298
Errors = List[str]
299299
Adjustment = NamedTuple('Adjustment', [

0 commit comments

Comments
 (0)