Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion openbb_platform/core/openbb_core/app/model/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class Example(BaseModel):
"""Example model."""

scope: str
scope: str = Field(frozen=True)

model_config = ConfigDict(validate_assignment=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def format_params( # noqa: PLR0912
qp_model := MethodDefinition.query_params_model(param.annotation)
) is not None:
for field_name, field in qp_model.model_fields.items():
field_anno = field.annotation
field_anno: Any = field.annotation
new_type = MethodDefinition.get_expanded_type(
field_name, None, field_anno
)
Expand All @@ -807,7 +807,7 @@ def format_params( # noqa: PLR0912
if field.is_required():
field_default: Any = Parameter.empty
elif field.default_factory is not None:
field_default = field.default_factory()
field_default = field.get_default(call_default_factory=True)
else:
field_default = field.default
formatted[field_name] = Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def __get_pydantic_json_schema__(

row_fields: dict[str, Any] = {}
for field_name, field_info in cls.model_fields.items():
annotation = field_info.annotation
annotation: Any = field_info.annotation
inner = (
get_args(annotation)[0]
if get_origin(annotation) is list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ def economy_shipping_chokepoint_info(
or getattr(kwargs["charting_settings"], "chart_style", "dark")
)
data = (
kwargs.pop("data", None)
kwargs.pop("data")
if "data" in kwargs and kwargs["data"] is not None
else kwargs.get("obbject_item")
else kwargs["obbject_item"]
)
fig = plot_chokepoint_annual_avg_vessels(data, theme=theme)
fig.update_layout(
Expand Down Expand Up @@ -601,9 +601,9 @@ def economy_shipping_port_info(
raise RuntimeError("Unable to import the required module.") from e

data = (
kwargs.pop("data", None)
kwargs.pop("data")
if "data" in kwargs and kwargs["data"] is not None
else kwargs.get("obbject_item")
else kwargs["obbject_item"]
)
fig = plot_port_info_map(data)
fig.update_layout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Literal,
TypeVar,
Union,
cast,
)
from warnings import warn

Expand Down Expand Up @@ -325,7 +326,9 @@ def _validate_x(data: ndarray | Series | type[TimeSeriesT]):
if forecast: # pragma: no cover - darts forecast path (darts is an optional dependency)
components = list(dataset.components[:4]) # ty: ignore[unresolved-attribute]
values = (
dataset[components].all_values(copy=False).flatten(order="F")
cast("TimeSeries", dataset)[components]
.all_values(copy=False)
.flatten(order="F")
)
n_components = len(components)
n_entries = len(values) // n_components
Expand Down
4 changes: 2 additions & 2 deletions openbb_platform/providers/eia/openbb_us_eia/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re
import threading
from collections.abc import AsyncIterator
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from pathlib import Path
from typing import Annotated, Any
Expand Down Expand Up @@ -2062,7 +2062,7 @@ async def render_browser(


@asynccontextmanager
async def lifespan(_app) -> AsyncIterator[None]:
async def lifespan(_app) -> AsyncGenerator[None, None]:
"""Warm the proxy cache for the lifetime of the API, cleaning up on shutdown."""
_schedule_warm()
try:
Expand Down
8 changes: 4 additions & 4 deletions openbb_platform/providers/finra/openbb_finra/utils/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""HTTP transport for the FINRA data services."""

from collections.abc import AsyncIterator, Awaitable, Callable
from collections.abc import AsyncGenerator, Awaitable, Callable
from contextlib import asynccontextmanager
from typing import Any

Expand Down Expand Up @@ -243,7 +243,7 @@ async def partitions(self, group: str, dataset: str) -> list[list[str]]:


@asynccontextmanager
async def query_api_session() -> AsyncIterator[QueryApiSession]:
async def query_api_session() -> AsyncGenerator[QueryApiSession, None]:
"""Open a session on the public FINRA Query API.

Yields
Expand Down Expand Up @@ -412,7 +412,7 @@ async def _trace_token(session: Any) -> str:


@asynccontextmanager
async def trace_session() -> AsyncIterator[TraceSession]:
async def trace_session() -> AsyncGenerator[TraceSession, None]:
"""Open a session on the public TRACE data service.

Yields
Expand Down Expand Up @@ -590,7 +590,7 @@ async def static_data(self, security_ids: list[str]) -> list[dict]:


@asynccontextmanager
async def market_data_session() -> AsyncIterator[MarketDataSession]:
async def market_data_session() -> AsyncGenerator[MarketDataSession, None]:
"""Open a seeded session on the FINRA Market Data Center.

Yields
Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/providers/fred/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ exclude = ["tests", "integration"]
[tool.ty.rules]
unresolved-import = "warn"

[[tool.ty.overrides]]
include = ["openbb_fred/models/**"]

[tool.ty.overrides.rules]
invalid-attribute-override = "ignore"
invalid-mutable-override = "ignore"

[tool.coverage.run]
branch = true
source = ["openbb_fred"]
Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/providers/imf/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ exclude = ["tests", "integration", "openbb_imf/utils/generate_cache.py"]
[tool.ty.rules]
unresolved-import = "ignore"

[[tool.ty.overrides]]
include = ["openbb_imf/models/**"]

[tool.ty.overrides.rules]
invalid-attribute-override = "ignore"
invalid-mutable-override = "ignore"

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --strict-markers"
Expand Down
4 changes: 2 additions & 2 deletions openbb_platform/providers/jodi/openbb_jodi/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

if TYPE_CHECKING:
import asyncio # noqa
from collections.abc import Iterator, Mapping # noqa
from collections.abc import Generator, Mapping # noqa
from datetime import date as dateType # noqa
from pathlib import Path # noqa
from typing import IO # noqa
Expand Down Expand Up @@ -361,7 +361,7 @@ def bump_checked_at(table: str, snapshot: dict) -> dict:


@contextmanager
def open_archive_csv(path: "Path") -> "Iterator":
def open_archive_csv(path: "Path") -> "Generator":
"""Open the CSV stream inside a raw source file, unzipping when needed."""
import zipfile

Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/providers/nasdaq/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ exclude = ["tests", "integration"]
[tool.ty.rules]
unresolved-import = "ignore"

[[tool.ty.overrides]]
include = ["openbb_nasdaq/models/**"]

[tool.ty.overrides.rules]
invalid-attribute-override = "ignore"
invalid-mutable-override = "ignore"

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --strict-markers"
Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/providers/sec/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ exclude = ["tests", "integration"]
[tool.ty.rules]
unresolved-import = "ignore"

[[tool.ty.overrides]]
include = ["openbb_sec/models/**"]

[tool.ty.overrides.rules]
invalid-attribute-override = "ignore"
invalid-mutable-override = "ignore"

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --strict-markers"
Expand Down
7 changes: 7 additions & 0 deletions openbb_platform/providers/tmx/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ exclude = ["tests", "integration"]
[tool.ty.rules]
unresolved-import = "warn"

[[tool.ty.overrides]]
include = ["openbb_tmx/models/**"]

[tool.ty.overrides.rules]
invalid-attribute-override = "ignore"
invalid-mutable-override = "ignore"

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "raise NotImplementedError", "@overload"]

Expand Down
Loading