diff --git a/openlibrary/core/lending.py b/openlibrary/core/lending.py index 17f5a470582..acff7027927 100644 --- a/openlibrary/core/lending.py +++ b/openlibrary/core/lending.py @@ -462,10 +462,11 @@ def get_ocaid(item: dict) -> str | None: possible_fields.remove('ia') possible_fields.append('ia') - ocaids = [] + ocaids: list[str] = [] for field in possible_fields: if item.get(field): - ocaids += item[field] if isinstance(item[field], list) else [item[field]] + val = cast(list[str] | str, item[field]) + ocaids += val if isinstance(val, list) else [val] ocaids = uniq(ocaids) return next((ocaid for ocaid in ocaids if not is_non_ia_ocaid(ocaid)), None) diff --git a/openlibrary/core/vendors.py b/openlibrary/core/vendors.py index 871732a38a9..2d7c1c2c050 100644 --- a/openlibrary/core/vendors.py +++ b/openlibrary/core/vendors.py @@ -587,8 +587,8 @@ def _get_betterworldbooks_metadata(isbn: str) -> dict | None: price = _price qlt = 'new' - market_price = ('$' + market_price[0]) if market_price else None - return betterworldbooks_fmt(isbn, qlt, price, market_price) + first_market_price = ('$' + market_price[0]) if market_price else None + return betterworldbooks_fmt(isbn, qlt, price, first_market_price) def betterworldbooks_fmt( diff --git a/requirements_test.txt b/requirements_test.txt index 908771821fd..3c166240e5d 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -4,7 +4,7 @@ -r requirements.txt debugpy>=1.6.4 -mypy==1.11.2 +mypy==1.13.0 pymemcache==4.0.0 pytest==8.3.3 pytest-asyncio==0.24.0