From 89256244f3951d985b1f7389363a34dfd7ac3f7e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 03:13:03 -0500 Subject: [PATCH] Update dependency mypy to v1.13.0 (#10028) * Update dependency mypy to v1.13.0 * Fix mypy type error * new variable for better typehint --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Drini Cami Co-authored-by: RayBB --- openlibrary/core/lending.py | 5 +++-- openlibrary/core/vendors.py | 4 ++-- requirements_test.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) 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