Skip to content

Commit

Permalink
chore(eyecite): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
flooie committed Jan 10, 2025
1 parent 95fdb1b commit b239171
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions eyecite/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,22 @@ def _filter_by_matching_plaintiff_or_defendant(
) -> Optional[ResourceType]:
"""Filter out any impossible reference citations"""
matches: List[ResourceType] = []

for full_citation, resource in resolved_full_cites:
if not isinstance(full_citation, FullCaseCitation):
continue
if (
full_citation.metadata.defendant
and defendant in full_citation.metadata.defendant
):
matches.append(resource)
elif (
full_citation.metadata.plaintiff
and plaintiff in full_citation.metadata.plaintiff
):
defendant_match = (
defendant
and full_citation.metadata.defendant
and defendant in full_citation.metadata.defendant
)
plaintiff_match = (
plaintiff
and full_citation.metadata.plaintiff
and plaintiff in full_citation.metadata.plaintiff
)
if defendant_match or plaintiff_match:
matches.append(resource)

# Remove duplicates and only accept if one candidate remains
matches = list(set(matches))
return matches[0] if len(matches) == 1 else None
Expand Down

0 comments on commit b239171

Please sign in to comment.