diff --git a/conservancy_beancount/filters.py b/conservancy_beancount/filters.py index 7c4bf3752f83402bca64dc3a913d84df59dbed23..8fbfec640bf0545020713c6eca4fa859f0d341f7 100644 --- a/conservancy_beancount/filters.py +++ b/conservancy_beancount/filters.py @@ -44,7 +44,7 @@ def audit_date(entries: Entries) -> Optional[datetime.date]: return entry.date return None -def filter_meta_equal(postings: Postings, key: MetaKey, value: MetaValue) -> Postings: +def filter_meta_equal(postings: Postings, key: MetaKey, value: MetaValue) -> Iterator[data.Posting]: for post in postings: try: if post.meta[key] == value: @@ -52,7 +52,7 @@ def filter_meta_equal(postings: Postings, key: MetaKey, value: MetaValue) -> Pos except KeyError: pass -def filter_meta_match(postings: Postings, key: MetaKey, regexp: Regexp) -> Postings: +def filter_meta_match(postings: Postings, key: MetaKey, regexp: Regexp) -> Iterator[data.Posting]: for post in postings: try: if re.search(regexp, post.meta[key]): @@ -60,7 +60,7 @@ def filter_meta_match(postings: Postings, key: MetaKey, regexp: Regexp) -> Posti except (KeyError, TypeError): pass -def filter_for_rt_id(postings: Postings, ticket_id: Union[int, str]) -> Postings: +def filter_for_rt_id(postings: Postings, ticket_id: Union[int, str]) -> Iterator[data.Posting]: """Filter postings with a primary RT ticket This functions yields postings where the *first* rt-id matches the given