From b56bf22e0b9d74af4f8761987fd90891dd2e0b5d Mon Sep 17 00:00:00 2001 From: William Palin Date: Fri, 10 Jan 2025 15:26:54 -0500 Subject: [PATCH] fix(eyecite): Flake8 fixes --- eyecite/find.py | 2 +- eyecite/models.py | 6 +++--- tests/test_FindTest.py | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/eyecite/find.py b/eyecite/find.py index 4e9defc..dfc717f 100644 --- a/eyecite/find.py +++ b/eyecite/find.py @@ -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: diff --git a/eyecite/models.py b/eyecite/models.py index 762dbbb..2d5d7a9 100644 --- a/eyecite/models.py +++ b/eyecite/models.py @@ -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 diff --git a/tests/test_FindTest.py b/tests/test_FindTest.py index b85403e..c04d7bb 100644 --- a/tests/test_FindTest.py +++ b/tests/test_FindTest.py @@ -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", @@ -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],