Skip to content

Commit

Permalink
Fix mypy and other compile errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein committed Nov 2, 2024
1 parent 920cbf4 commit 0cfb3f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/palace/manager/feed/opds.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def entry_as_response(
),
**response_kwargs,
)
if isinstance(serializer, OPDS2Version1Serializer):
if isinstance(serializer, OPDS2Serializer):
# Only OPDS2 has the same content type for feed and entry
response.content_type = serializer.content_type()
return response
Expand Down
4 changes: 2 additions & 2 deletions src/palace/manager/feed/serializer/opds2.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def serialize_work_entry(self, data: WorkEntryData) -> dict[str, Any]:
return publication

def _serialize_link(self, link: Link) -> dict[str, Any]:
serialized = {"href": link.href, "rel": link.rel}
serialized: dict[str, Any] = {"href": link.href, "rel": link.rel}
if link.type:
serialized["type"] = link.type
if link.title:
Expand Down Expand Up @@ -226,7 +226,7 @@ def content_type(self) -> str:
def to_string(cls, data: dict[str, Any]) -> str:
return json.dumps(data, indent=2)

def _serialize_feed_links(self, feed: FeedData) -> list[Link]:
def _serialize_feed_links(self, feed: FeedData) -> list[dict[str, Any]]:
links = []
if feed.links:
for link in feed.links:
Expand Down
6 changes: 3 additions & 3 deletions tests/manager/api/controller/test_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
)
from palace.manager.core.opds_import import OPDSAPI
from palace.manager.core.problem_details import INTEGRATION_ERROR, INVALID_INPUT
from palace.manager.feed.serializer.opds2 import OPDS2Version1Serializer
from palace.manager.feed.serializer.opds2 import OPDS2Serializer
from palace.manager.service.redis.models.patron_activity import PatronActivity
from palace.manager.sqlalchemy.constants import MediaTypes
from palace.manager.sqlalchemy.model.collection import Collection
Expand Down Expand Up @@ -132,8 +132,8 @@ class OPDSSerializationTestHelper:
("default-foo-bar", OPDSFeed.ENTRY_TYPE),
(AtomFeed.ATOM_TYPE, OPDSFeed.ENTRY_TYPE),
(
OPDS2Version1Serializer.CONTENT_TYPE,
OPDS2Version1Serializer.CONTENT_TYPE,
OPDS2Serializer.CONTENT_TYPE,
OPDS2Serializer.CONTENT_TYPE,
),
],
)
Expand Down
2 changes: 1 addition & 1 deletion tests/manager/feed/test_opds2_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def test_serialize_opds_message(self):
OPDSMessage("URN", 200, "Description")
) == dict(urn="URN", description="Description")

def test_serialize_feed(self):
def test_serialize_feed_sort_and_facet_links(self):
feed_data = FeedData()

# specify a sort link
Expand Down

0 comments on commit 0cfb3f6

Please sign in to comment.