fix ty check failures exposed by newer version

This commit is contained in:
Danglewood
2026-07-22 11:48:28 -07:00
parent 80634fe604
commit a07534cfa4
4 changed files with 23 additions and 13 deletions

View File

@@ -377,14 +377,16 @@ def _quick_schema_type(schema: dict[str, Any]) -> str:
if schema_type == "object" or "properties" in schema:
title = schema.get("title")
return title or "object"
if schema_type in _PRIMITIVE_TYPES:
if schema_type == "string":
fmt = schema.get("format")
if fmt == "date":
return "date"
if fmt == "date-time":
return "datetime"
return _PRIMITIVE_TYPES[schema_type]
if isinstance(schema_type, str):
primitive_type = _PRIMITIVE_TYPES.get(schema_type)
if primitive_type is not None:
if schema_type == "string":
fmt = schema.get("format")
if fmt == "date":
return "date"
if fmt == "date-time":
return "datetime"
return primitive_type
return "Any"

View File

@@ -566,7 +566,7 @@ def _kpss_block(values, regression: str) -> dict:
from statsmodels.tsa.stattools import kpss
kpss_reg: Literal["c", "ct"] = "c" if regression not in {"c", "ct"} else regression # ty: ignore[invalid-assignment]
kpss_reg: Literal["c", "ct"] = "c" if regression not in {"c", "ct"} else regression
with warnings.catch_warnings():
warnings.simplefilter("ignore")
stat, pvalue, _, crit = kpss(values, regression=kpss_reg, nlags="auto")

View File

@@ -553,6 +553,8 @@ def get_international_portfolio_data(
with zipfile.ZipFile(BytesIO(response.content)) as f:
filenames = f.namelist()
if index is None:
raise ValueError("Could not resolve portfolio index from input parameters.")
if index in filenames:
try:

View File

@@ -364,10 +364,16 @@ class ImfBalanceOfPaymentsFetcher(
"debits_total_secondary_income",
)
]
if all(v is not None for v in credits_components):
bucket["credits_total"] = sum(credits_components)
if all(v is not None for v in debits_components):
bucket["debits_total"] = sum(debits_components)
credits_components_clean = [
float(v) for v in credits_components if v is not None
]
debits_components_clean = [
float(v) for v in debits_components if v is not None
]
if len(credits_components_clean) == 4:
bucket["credits_total"] = sum(credits_components_clean)
if len(debits_components_clean) == 4:
bucket["debits_total"] = sum(debits_components_clean)
services_credits = bucket.get("credits_total_services")
services_debits = bucket.get("debits_total_services")