mirror of
https://gitee.com/vnpy/vnpy.git
synced 2025-12-06 11:29:14 +08:00
[Fix] mypy报错
This commit is contained in:
2
.github/workflows/pythonapp.yml
vendored
2
.github/workflows/pythonapp.yml
vendored
@@ -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
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user