Skip to content

Commit a4c1633

Browse files
committed
Fixed typing in DocDetails.__add__
1 parent 1c6e386 commit a4c1633

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/paperqa/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
11491149
if self.publication_date and other.publication_date:
11501150
PREFER_OTHER = self.publication_date <= other.publication_date
11511151

1152-
merged_data = {}
1152+
merged_data: dict[str, Any] = {}
11531153
# pylint: disable-next=not-an-iterable # pylint bug: https://github.com/pylint-dev/pylint/issues/10144
11541154
for field in type(self).model_fields:
11551155
self_value = getattr(self, field)
@@ -1189,11 +1189,11 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
11891189
)
11901190
else other.authors
11911191
)
1192-
merged_data[field] = best_authors or None # type: ignore[assignment]
1192+
merged_data[field] = best_authors or None
11931193

11941194
elif field == "key" and self_value is not None and other_value is not None:
11951195
# if we have multiple keys, we wipe them and allow regeneration
1196-
merged_data[field] = None # type: ignore[assignment]
1196+
merged_data[field] = None
11971197

11981198
elif field in {"citation_count", "year", "publication_date"}:
11991199
# get the latest data
@@ -1226,7 +1226,7 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
12261226
# Recalculate doc_id if doi has changed
12271227
if merged_data["doi"] != self.doi:
12281228
merged_data["doc_id"] = (
1229-
encode_id(merged_data["doi"].lower()) if merged_data["doi"] else None # type: ignore[attr-defined,assignment]
1229+
encode_id(merged_data["doi"].lower()) if merged_data["doi"] else None
12301230
)
12311231

12321232
# Create and return new DocDetails instance

0 commit comments

Comments
 (0)