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