Skip to content

Commit 2776815

Browse files
committed
Fixed typing in DocDetails.__add__
1 parent 31cd959 commit 2776815

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
@@ -1052,7 +1052,7 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
10521052
if self.publication_date and other.publication_date:
10531053
PREFER_OTHER = self.publication_date <= other.publication_date
10541054

1055-
merged_data = {}
1055+
merged_data: dict[str, Any] = {}
10561056
# pylint: disable-next=not-an-iterable # pylint bug: https://github.com/pylint-dev/pylint/issues/10144
10571057
for field in type(self).model_fields:
10581058
self_value = getattr(self, field)
@@ -1092,11 +1092,11 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
10921092
)
10931093
else other.authors
10941094
)
1095-
merged_data[field] = best_authors or None # type: ignore[assignment]
1095+
merged_data[field] = best_authors or None
10961096

10971097
elif field == "key" and self_value is not None and other_value is not None:
10981098
# if we have multiple keys, we wipe them and allow regeneration
1099-
merged_data[field] = None # type: ignore[assignment]
1099+
merged_data[field] = None
11001100

11011101
elif field in {"citation_count", "year", "publication_date"}:
11021102
# get the latest data
@@ -1129,7 +1129,7 @@ def __add__(self, other: DocDetails | int) -> DocDetails: # noqa: PLR0912
11291129
# Recalculate doc_id if doi has changed
11301130
if merged_data["doi"] != self.doi:
11311131
merged_data["doc_id"] = (
1132-
encode_id(merged_data["doi"].lower()) if merged_data["doi"] else None # type: ignore[attr-defined,assignment]
1132+
encode_id(merged_data["doi"].lower()) if merged_data["doi"] else None
11331133
)
11341134

11351135
# Create and return new DocDetails instance

0 commit comments

Comments
 (0)