Skip to content

Commit

Permalink
Update api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jan 22, 2024
1 parent 179118c commit d8c8dbe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/semra/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d8c8dbe

Please sign in to comment.