fix new ty issues

This commit is contained in:
Danglewood
2026-09-17 14:06:27 -07:00
parent b59b2b18bd
commit 99e5c8618e
6 changed files with 13 additions and 11 deletions

View File

@@ -286,7 +286,7 @@ def correlation_matrix(
if hasattr(anchor, "date") and callable(
anchor.date
): # pragma: no cover - object-index path is used in practice
as_of_out = anchor.date() # ty: ignore[invalid-assignment, call-top-callable]
as_of_out = anchor.date() # ty: ignore[invalid-assignment]
elif isinstance(anchor, date):
as_of_out = anchor
else: # pragma: no cover - unexpected anchor type

View File

@@ -455,10 +455,7 @@ def _ta_ma(**kwargs):
data = basemodel_to_df(kwargs["obbject_item"], index=index)
if isinstance(data, list):
# ``data`` is opaque ``Any`` until the isinstance narrows it, and
# ``basemodel_to_df`` declares ``list[Data] | Data``. Callers pass
# a list of ``Data``-compatible models here at runtime.
data = basemodel_to_df(data, index=index) # ty: ignore[invalid-argument-type]
data = basemodel_to_df(data, index=index)
window = (
kwargs.get("length", [])

View File

@@ -531,7 +531,7 @@ async def presentation_table_choices(
elif dim_id == country_dim:
pb.set_dimension((dim_id, str(country).replace(",", "+")))
options = pb.get_options_for_dimension(freq_dim) if freq_dim else []
options = pb.get_options_for_dimension(freq_dim)
return options
@@ -973,13 +973,13 @@ async def indicator_choices( # noqa: PLR0912
return choices
if country == "true" and country_dim:
if country == "true":
choices = get_choices_for_dim(country_dim)
choices = sorted(choices, key=lambda x: x["label"])
choices.insert(0, {"label": "All Countries", "value": "*"})
return choices
if frequency == "true" and freq_dim:
if frequency == "true":
return get_choices_for_dim(freq_dim)
if transform == "true" and effective_transform_dim:

View File

@@ -45,7 +45,12 @@ class ImfMetadata(
return
with self._lock:
if self._initialized:
# Re-read under the lock: another thread can finish initialising
# between the check above and this one acquiring the lock, which is
# the whole point of the second check. ty carries the narrowing from
# the check above through the lock acquisition and so reads this as
# dead - it cannot model the interleaving.
if self._initialized: # ty: ignore[redundant-condition]
return
self.dataflows: dict[str, dict] = {}

View File

@@ -208,7 +208,7 @@ class OECDCPIFetcher(Fetcher[OECDCPIQueryParams, list[OECDCPIData]]):
if query.harmonized is True and freq == "quarter":
freq = "monthly"
freq_code = _FREQ_MAP.get(freq, freq[0].upper() if freq else "M")
freq_code = _FREQ_MAP.get(freq, freq[0].upper())
transform_code = _TRANSFORM_MAP.get(query.transform, "_Z")
exp_items = [s.strip() for s in query.expenditure.split(",") if s.strip()]
if "all" in exp_items:

View File

@@ -155,7 +155,7 @@ class OECDHousePriceIndexFetcher(
if value is None or value == "":
continue
if query.transform and query.transform != "index":
if query.transform != "index":
value = float(value) / 100.0
output.append(