Skip to content

Commit

Permalink
EKIR-219 Fix linting, types
Browse files Browse the repository at this point in the history
  • Loading branch information
natlibfi-kaisa committed Feb 12, 2025
1 parent 2e883bc commit edefb05
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/odl.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _get_hasher(self) -> Hasher:
return self._hasher_instance

def _get(
self, url: str, headers: dict[str, str] | None = None, *args, **kwargs
self, url: str, headers: dict[str, str] | None = None, *args: Any, **kwargs: Any
) -> Response:
"""Make a normal HTTP request, but include an authentication
header with the credentials for the collection.
Expand Down
6 changes: 3 additions & 3 deletions api/opds_for_distributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import datetime
import json
from collections.abc import Generator
from collections.abc import Generator, Mapping
from typing import TYPE_CHECKING, Any

import feedparser
Expand Down Expand Up @@ -461,8 +461,8 @@ def __init__(
self.api = OPDSForDistributorsAPI(_db, collection)

def _get(
self, url: str, headers: dict[str, str]
) -> tuple[int, dict[str, str], bytes]:
self, url: str, headers: Mapping[str, str]
) -> Response:
"""Make a normal HTTP request for an OPDS feed, but add in an
auth header with the credentials for the collection.
"""
Expand Down
4 changes: 2 additions & 2 deletions core/opds_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import urllib
from abc import ABC, abstractmethod
from collections import defaultdict
from collections.abc import Callable, Generator, Iterable, Sequence
from collections.abc import Callable, Generator, Iterable, Mapping, Sequence
from datetime import datetime
from io import BytesIO
from typing import TYPE_CHECKING, Any, Generic, TypeVar, cast, overload
Expand Down Expand Up @@ -1738,7 +1738,7 @@ def _get_accept_header(self) -> str:
]
)

def _update_headers(self, headers: dict[str, str] | None) -> dict[str, str]:
def _update_headers(self, headers: Mapping[str, str] | None) -> dict[str, str]:
headers = dict(headers) if headers else {}
if self.username and self.password and not "Authorization" in headers:
headers["Authorization"] = "Basic %s" % base64.b64encode(
Expand Down
2 changes: 1 addition & 1 deletion core/util/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _request_with_timeout(
# a generic RequestNetworkException.
raise RequestNetworkException(url, e)

return process_response_with( # type: ignore[no-any-return]
return process_response_with(
url,
response,
allowed_response_codes,
Expand Down

0 comments on commit edefb05

Please sign in to comment.