mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-12-01 13:44:16 +00:00
fix new ty issues
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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", [])
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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] = {}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user