Skip to content

Commit

Permalink
typing hinting for combined_removals
Browse files Browse the repository at this point in the history
  • Loading branch information
Zburatorul committed Sep 18, 2024
1 parent ddc5af6 commit 2d91280
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions beancount_import/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions beancount_import/source/amazon_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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', [
Expand Down

0 comments on commit 2d91280

Please sign in to comment.