chore: update to new syntax

This commit is contained in:
Matthias
2024-11-17 10:22:06 +01:00
parent 3ba3d7ffcf
commit f3b0e404f0
3 changed files with 8 additions and 8 deletions

View File

@@ -328,7 +328,7 @@ def refresh_backtest_ohlcv_data(
erase: bool = False,
data_format: str | None = None,
prepend: bool = False,
progress_tracker: Optional[ProgressLike] = None,
progress_tracker: ProgressLike | None = None,
) -> list[str]:
"""
Refresh stored ohlcv data for backtesting and hyperopt operations.
@@ -495,7 +495,7 @@ def refresh_backtest_trades_data(
new_pairs_days: int = 30,
erase: bool = False,
data_format: str = "feather",
progress_tracker: Optional[ProgressLike] = None,
progress_tracker: ProgressLike | None = None,
) -> list[str]:
"""
Refresh stored trades data for backtesting and hyperopt operations.
@@ -597,7 +597,7 @@ def download_data(
config: Config,
exchange: Exchange,
*,
progress_tracker: Optional[ProgressLike] = None,
progress_tracker: ProgressLike | None = None,
) -> None:
"""
Download data function. Used from both cli and API.

View File

@@ -490,9 +490,9 @@ class PairListsPayload(ExchangeModePayloadMixin, BaseModel):
class DownloadDataPayload(ExchangeModePayloadMixin, BaseModel):
pairs: list[str]
timeframes: Optional[list[str]] = DL_DATA_TIMEFRAMES
days: Optional[int] = None
timerange: Optional[str] = None
timeframes: list[str] | None = DL_DATA_TIMEFRAMES
days: int | None = None
timerange: str | None = None
@model_validator(mode="before")
def check_mutually_exclusive(cls, values):

View File

@@ -1,5 +1,5 @@
from contextlib import AbstractContextManager
from typing import Optional, Protocol
from typing import Protocol
from rich.progress import (
BarColumn,
@@ -20,7 +20,7 @@ class ProgressLike(Protocol, AbstractContextManager["ProgressLike"]):
def update(self, task_id: TaskID, *, advance: float | None = None, **kwargs): ...
def retrieve_progress_tracker(pt: Optional[ProgressLike]) -> ProgressLike:
def retrieve_progress_tracker(pt: ProgressLike | None) -> ProgressLike:
if pt is None:
return get_progress_tracker()
return pt