From d8c8dbe39ec265ac637562888b67567caacc0cdb Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Mon, 22 Jan 2024 15:13:50 +0100 Subject: [PATCH] Update api.py --- src/semra/api.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/semra/api.py b/src/semra/api.py index 747c6a6..eb2cf28 100644 --- a/src/semra/api.py +++ b/src/semra/api.py @@ -341,7 +341,9 @@ def filter_self_matches(mappings: Iterable[Mapping], *, progress: bool = True) - ] -def filter_mappings(mappings: t.List[Mapping], skip_mappings: t.List[Mapping], *, progress: bool = True) -> t.List[Mapping]: +def filter_mappings( + mappings: t.List[Mapping], skip_mappings: t.List[Mapping], *, progress: bool = True +) -> t.List[Mapping]: """Filter out mappings in the second set from the first set.""" skip_triples = {skip_mapping.triple for skip_mapping in skip_mappings} return [ @@ -381,7 +383,12 @@ def filter_many_to_many(mappings: t.List[Mapping], *, progress: bool = True) -> def project( - mappings: t.List[Mapping], source_prefix: str, target_prefix: str, *, return_sus: bool = False, progress: bool = False + mappings: t.List[Mapping], + source_prefix: str, + target_prefix: str, + *, + return_sus: bool = False, + progress: bool = False, ) -> t.List[Mapping] | t.Tuple[t.List[Mapping], t.List[Mapping]]: """Ensure that each identifier only appears as the subject of one mapping.""" mappings = keep_subject_prefixes(mappings, source_prefix, progress=progress)