mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
fixes for ty
This commit is contained in:
@@ -10,7 +10,7 @@ from typing import Any
|
||||
if sys.version_info >= (3, 11): # pragma: no cover
|
||||
import tomllib
|
||||
else: # pragma: no cover
|
||||
import tomli as tomllib # ty: ignore[unresolved-import]
|
||||
import tomli as tomllib
|
||||
|
||||
DEFAULT_CONFIG_NAMES: tuple[str, ...] = ("openbb.toml", ".openbb.toml")
|
||||
PYPROJECT_NAME = "pyproject.toml"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Views for the Econometrics Extension."""
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from openbb_charting.core.openbb_figure import (
|
||||
@@ -35,4 +35,5 @@ class EconometricsViews:
|
||||
"""
|
||||
from openbb_charting.charts.correlation_matrix import correlation_matrix
|
||||
|
||||
return correlation_matrix(**kwargs)
|
||||
figure, content = correlation_matrix(**kwargs)
|
||||
return cast("OpenBBFigure", figure), content
|
||||
|
||||
@@ -453,7 +453,7 @@ def calculate_cones(
|
||||
|
||||
df_ = [realized, min_, bottom_q, median, top_q, max_]
|
||||
df_windows = allowed_windows
|
||||
df = DataFrame(df_, columns=df_windows) # ty: ignore[invalid-argument-type]
|
||||
df = DataFrame(df_, columns=df_windows)
|
||||
df = df.rename(
|
||||
index={
|
||||
0: "realized",
|
||||
|
||||
@@ -217,10 +217,7 @@ def multi(params: MultiQueryParams) -> OBBject[list[MultiResultRow]]:
|
||||
bucket[f"{request.indicator}.{col}"] = value
|
||||
|
||||
ordered_keys = sorted(merged.keys(), key=str)
|
||||
out_rows = [
|
||||
MultiResultRow(date=key, values=merged[key]) # ty: ignore[invalid-argument-type]
|
||||
for key in ordered_keys
|
||||
]
|
||||
out_rows = [MultiResultRow(date=key, values=merged[key]) for key in ordered_keys]
|
||||
return OBBject(results=out_rows)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Views for the technical Extension."""
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import TYPE_CHECKING, Any, Literal, cast
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from openbb_charting.core.openbb_figure import (
|
||||
@@ -349,9 +349,11 @@ class TechnicalViews:
|
||||
show_tails = kwargs.get("show_tails")
|
||||
show_tails = True if show_tails is None else show_tails
|
||||
tail_periods = int(kwargs["tail_periods"]) if "tail_periods" in kwargs else 16
|
||||
tail_interval = (
|
||||
str(kwargs.get("tail_interval")) if "tail_interval" in kwargs else "week"
|
||||
)
|
||||
tail_interval_input = kwargs.get("tail_interval", "week")
|
||||
if tail_interval_input not in ("day", "week", "month"):
|
||||
tail_interval: Literal["day", "week", "month"] = "week"
|
||||
else:
|
||||
tail_interval = cast(Literal["day", "week", "month"], tail_interval_input)
|
||||
date = kwargs.get("date") if "date" in kwargs else None
|
||||
show_tails = False if date is not None else show_tails
|
||||
if ratios_df.empty or momentum_df.empty:
|
||||
|
||||
Reference in New Issue
Block a user