diff --git a/beancount_import/matching.py b/beancount_import/matching.py index 54bde06a..f9f5710c 100644 --- a/beancount_import/matching.py +++ b/beancount_import/matching.py @@ -314,7 +314,7 @@ def search_postings(self, negate=False) -> Iterable[SearchPosting]: # Prepare postings for searching postings_date_currency = collections.defaultdict(list) - + for mp in mps: weight = get_posting_weight(mp.posting) if weight is None: @@ -1489,8 +1489,9 @@ def get_combined_transactions(txns: Tuple[Transaction, Transaction], for match_sets in itertools.product(*match_groups.values()): combined_matches = sum((match_set.matches for match_set in match_sets), []) # type: PostingMatches - combined_removals = sum((match_set.removals - for match_set in match_sets), ()) + combined_removals: MatchablePostings = tuple(removal + for match_set in match_sets + for removal in match_set.removals) if not combined_matches: continue for m in combined_matches: diff --git a/beancount_import/source/amazon_invoice.py b/beancount_import/source/amazon_invoice.py index 8dd48ef9..608cf357 100644 --- a/beancount_import/source/amazon_invoice.py +++ b/beancount_import/source/amazon_invoice.py @@ -29,7 +29,7 @@ | +-> returns Order """ -from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast +from typing import NamedTuple, Optional, List, Union, Iterable, Dict, Sequence, cast, Type from abc import ABC, abstractmethod import collections import re @@ -293,7 +293,7 @@ def parse_date(date_str) -> datetime.date: return dateutil.parser.parse(date_str, parserinfo=Locale_de_DE._parserinfo(dayfirst=True)).date() -LOCALES = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]} +LOCALES: Dict[str, Type[Locale_Data]] = {x.LOCALE: x for x in [Locale_en_US, Locale_de_DE]} Errors = List[str] Adjustment = NamedTuple('Adjustment', [