From 460a7d7bc5706023cacb73652e3c7226d304f02a Mon Sep 17 00:00:00 2001 From: mlissner Date: Fri, 22 Jul 2022 19:36:31 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20freelawp?= =?UTF-8?q?roject/eyecite@3e2a031c11e69523eb71450d3c20e4856c85c9a5=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- annotate.html | 2 +- models.html | 76 ++++++++++++++++++++++++++++++++++++++++----------- resolve.html | 7 +++++ 3 files changed, 68 insertions(+), 17 deletions(-) diff --git a/annotate.html b/annotate.html index 6996543..71a9c84 100644 --- a/annotate.html +++ b/annotate.html @@ -216,7 +216,7 @@

Module eyecite.annotate

""" try: return fast_diff_match_patch.diff( - a, b, timelimit=0, checklines=False, cleanup="No", + a, b, timelimit=0, checklines=False, cleanup="No" ) except AttributeError as e: raise AttributeError( diff --git a/models.html b/models.html index 84e354c..d7ddb33 100644 --- a/models.html +++ b/models.html @@ -111,6 +111,9 @@

Module eyecite.models

if isinstance(self.metadata, dict) else self.Metadata() ) + # Set known missing page numbers to None + if re.search("^_+$", self.groups.get("page", "") or ""): + self.groups["page"] = None def __repr__(self): """Simplified repr() to be more readable than full dataclass repr(). @@ -131,8 +134,12 @@

Module eyecite.models

def comparison_hash(self) -> int: """Return hash that will be the same if two cites are semantically - equivalent.""" - return hash((type(self), tuple(self.groups.items()))) + equivalent, unless the citation is a CaseCitation missing a page. + """ + if isinstance(self, CaseCitation) and self.groups["page"] is None: + return id(self) + else: + return hash((type(self), tuple(self.groups.items()))) def corrected_citation(self): """Return citation with any variations normalized.""" @@ -642,7 +649,12 @@

Module eyecite.models

def __hash__(self): """Resources are the same if their citations are semantically - equivalent.""" + equivalent. + + Note: Resources composed of citations with missing page numbers are + NOT considered the same, even if their other attributes are identical. + This is to avoid potential false positives. + """ return self.citation.comparison_hash() def __eq__(self, other): @@ -771,7 +783,7 @@

Inherited members