From 99e5c8618e25a2a22110c474ec9d715a17ddcc78 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Thu, 17 Sep 2026 14:06:27 -0700 Subject: [PATCH] fix new ty issues --- .../technical/openbb_technical/multi/correlation.py | 2 +- .../technical/openbb_technical/technical_views.py | 5 +---- openbb_platform/providers/imf/openbb_imf/imf_router.py | 6 +++--- .../providers/imf/openbb_imf/utils/metadata/_core.py | 7 ++++++- .../oecd/openbb_oecd/models/consumer_price_index.py | 2 +- .../providers/oecd/openbb_oecd/models/house_price_index.py | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/openbb_platform/extensions/technical/openbb_technical/multi/correlation.py b/openbb_platform/extensions/technical/openbb_technical/multi/correlation.py index 14ab606f279..b0db61432b4 100644 --- a/openbb_platform/extensions/technical/openbb_technical/multi/correlation.py +++ b/openbb_platform/extensions/technical/openbb_technical/multi/correlation.py @@ -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 diff --git a/openbb_platform/extensions/technical/openbb_technical/technical_views.py b/openbb_platform/extensions/technical/openbb_technical/technical_views.py index 2047f0579ee..6a466109a16 100644 --- a/openbb_platform/extensions/technical/openbb_technical/technical_views.py +++ b/openbb_platform/extensions/technical/openbb_technical/technical_views.py @@ -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", []) diff --git a/openbb_platform/providers/imf/openbb_imf/imf_router.py b/openbb_platform/providers/imf/openbb_imf/imf_router.py index 30935a009fa..485c3dc0d8e 100644 --- a/openbb_platform/providers/imf/openbb_imf/imf_router.py +++ b/openbb_platform/providers/imf/openbb_imf/imf_router.py @@ -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: diff --git a/openbb_platform/providers/imf/openbb_imf/utils/metadata/_core.py b/openbb_platform/providers/imf/openbb_imf/utils/metadata/_core.py index 8cbd19ab72a..20de5b74919 100644 --- a/openbb_platform/providers/imf/openbb_imf/utils/metadata/_core.py +++ b/openbb_platform/providers/imf/openbb_imf/utils/metadata/_core.py @@ -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] = {} diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/consumer_price_index.py b/openbb_platform/providers/oecd/openbb_oecd/models/consumer_price_index.py index fa40f937d1b..acf77a17cce 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/consumer_price_index.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/consumer_price_index.py @@ -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: diff --git a/openbb_platform/providers/oecd/openbb_oecd/models/house_price_index.py b/openbb_platform/providers/oecd/openbb_oecd/models/house_price_index.py index a91466bc538..2afc5c0c904 100644 --- a/openbb_platform/providers/oecd/openbb_oecd/models/house_price_index.py +++ b/openbb_platform/providers/oecd/openbb_oecd/models/house_price_index.py @@ -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(