Skip to content

Commit

Permalink
fix(eyecite): Flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
flooie committed Jan 10, 2025
1 parent fa419aa commit b56bf22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eyecite/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _extract_reference_citations(
:param plain_text: the text
:return: Pincite reference citations
"""
if type(citation) != FullCaseCitation:
if not isinstance(citation, FullCaseCitation):
# Skip if not case law citation
return []
if not citation.metadata.defendant:
Expand Down
6 changes: 3 additions & 3 deletions eyecite/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ def is_parallel_citation(self, preceding: CitationBase):
"""
is_parallel = (
self.full_span_start == preceding.full_span_start
and self.full_span_end == preceding.full_span_end
and type(preceding) == FullCaseCitation
self.full_span_start == preceding.full_span_start
and self.full_span_end == preceding.full_span_end
and isinstance(preceding, FullCaseCitation)
)
if is_parallel:
self.metadata.defendant = preceding.metadata.defendant
Expand Down
8 changes: 5 additions & 3 deletions tests/test_FindTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,10 @@ def test_find_citations(self):
# Test reference against defendant name
('In re Foo 1 Mass. 12, 347-348. something something, in Foo at 62 we see that, ',
[case_citation(page='12', reporter="Mass.", volume="1",
metadata={'defendant': 'Foo', 'pin_cite': '347-348'})]),
metadata={'defendant': 'Foo', 'pin_cite': '347-348'}),
reference_citation('Foo at 62',
metadata={'defendant': 'Foo',
"pin_cite": "62"})]),
# Test reference citation after an id citation
('we said in Morton v. Mancari, 417 U. S. 535, 552 (1974) “Literally every piece ....”. “asisovereign tribal entities . . . .” Id. In Mancari at 665',
[case_citation(page='535', year=1974, volume="417",
Expand Down Expand Up @@ -762,8 +765,7 @@ def test_citation_fullspan(self):
self.assertEqual(
extracted[cit_idx].full_span()[0],
start,
f"full_span start index doesn't match for {
extracted[cit_idx]}",
f"full_span start index doesn't match for {extracted[cit_idx]}",
)
self.assertEqual(
extracted[cit_idx].full_span()[1],
Expand Down

0 comments on commit b56bf22

Please sign in to comment.