Skip to content

Commit

Permalink
delete get_foreign_match_list
Browse files Browse the repository at this point in the history
It wasn't in use, I'm not sure it's still relevant,
and it probably could have been accomplished more
easily by calling a normal method on "other" instead
of calling a "foreign" method on "self".
  • Loading branch information
mscarey committed Jun 9, 2019
1 parent 2bc5340 commit 3d7a4d5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
27 changes: 0 additions & 27 deletions authorityspoke/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,33 +453,6 @@ def all_relation_matches(
matchlist = relation.update_matchlist(matchlist)
return matchlist

@staticmethod
def get_foreign_match_list(
foreign: List[Dict[Factor, Factor]]
) -> List[Dict[Factor, Factor]]:
"""
Compare this to the regular ``matchlist`` objects, in
which the indices represent self's entity slots and the
values represent other's.
:returns:
a version of ``matchlist`` in which the indices
represent ``foreign``'s entity slots and the values
represent ``self``'s entity slots.
"""

def get_foreign_match(
match: Dict[Factor, Factor]
) -> Optional[Dict[Factor, Factor]]:
# TODO: write test for multiple keys of match with same value (other than None)
return {v: k for k, v in match.items() if v is not None}

return [
get_foreign_match(match)
for match in foreign
if get_foreign_match(match) is not None
]


@dataclass(frozen=True)
class Rule(Factor):
Expand Down
6 changes: 0 additions & 6 deletions tests/test_procedures.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ def test_procedure_string_with_entities(self, make_procedure):
make_procedure["c2_irrelevant_inputs"]
)

def test_foreign_match_list(self, make_procedure, watt_mentioned):
w = watt_mentioned
assert make_procedure["c2_irrelevant_inputs"].get_foreign_match_list(
[{w[2]: w[1], w[3]: w[0]}, {w[1]: w[1], w[2]: w[3]}]
) == [{w[1]: w[2], w[0]: w[3]}, {w[1]: w[1], w[3]: w[2]}]

def test_generic_factors(
self, watt_factor, make_entity, make_evidence, make_procedure
):
Expand Down

0 comments on commit 3d7a4d5

Please sign in to comment.