[Fix] mypy报错

This commit is contained in:
noranhe
2025-06-17 09:30:56 +08:00
parent de3145422e
commit 29cb430181
5 changed files with 6 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install ruff mypy uv pip install ruff mypy uv types-tqdm
uv pip install ta-lib==0.6.4 --index=https://pypi.vnpy.com --system uv pip install ta-lib==0.6.4 --index=https://pypi.vnpy.com --system
uv pip install -e .[alpha,dev] --system uv pip install -e .[alpha,dev] --system
- name: Lint with ruff - name: Lint with ruff

View File

@@ -8,7 +8,7 @@ from .utility import to_datetime
def process_drop_na(df: pl.DataFrame, names: list[str] | None = None) -> pl.DataFrame: def process_drop_na(df: pl.DataFrame, names: list[str] | None = None) -> pl.DataFrame:
"""Remove rows with missing values""" """Remove rows with missing values"""
if not names: if names is None:
names = df.columns[2:-1] names = df.columns[2:-1]
for name in names: for name in names:

View File

@@ -11,7 +11,8 @@ from .utility import DataProxy
def to_pd_series(feature: DataProxy) -> pd.Series: def to_pd_series(feature: DataProxy) -> pd.Series:
"""Convert to pandas.Series data structure""" """Convert to pandas.Series data structure"""
return feature.df.to_pandas().set_index(["datetime", "vt_symbol"])["data"] series: pd.Series = feature.df.to_pandas().set_index(["datetime", "vt_symbol"])["data"]
return series
def to_pl_dataframe(series: pd.Series) -> pl.DataFrame: def to_pl_dataframe(series: pd.Series) -> pl.DataFrame:

View File

@@ -156,4 +156,4 @@ def get_database() -> BaseDatabase:
# Create database object from module # Create database object from module
database = module.Database() database = module.Database()
return database # type: ignore return database

View File

@@ -65,4 +65,4 @@ def get_datafeed() -> BaseDatafeed:
print(_("无法加载数据服务模块,请运行 pip install {} 尝试安装").format(module_name)) print(_("无法加载数据服务模块,请运行 pip install {} 尝试安装").format(module_name))
return datafeed # type: ignore return datafeed