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 gokart/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def save(self, df: pd.DataFrame, file_path: str) -> None:
def load(file_path: str) -> pd.DataFrame:
dir_path = os.path.dirname(file_path)

return pd.concat([pd.read_pickle(fp) for fp in glob(os.path.join(dir_path, 'data_*.pkl'))])
return cast(pd.DataFrame, pd.concat([pd.read_pickle(fp) for fp in glob(os.path.join(dir_path, 'data_*.pkl'))]))


def _make_file_system_target(file_path: str, processor: FileProcessor | None = None, store_index_in_feather: bool = True) -> luigi.target.FileSystemTarget:
Expand Down
4 changes: 2 additions & 2 deletions gokart/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
from collections.abc import Callable, Iterable
from io import BytesIO
from typing import Any, Literal, Protocol, TypeAlias, TypeVar, get_args, get_origin
from typing import Any, Literal, Protocol, TypeAlias, TypeVar, cast, get_args, get_origin

import dill
import luigi
Expand Down Expand Up @@ -91,7 +91,7 @@ def load_dill_with_pandas_backward_compatibility(file: FileLike | BytesIO) -> An
except Exception:
assert file.seekable(), f'{file} is not seekable.'
file.seek(0)
return pd.read_pickle(file)
return pd.read_pickle(cast(Any, file))

@hiro-o918 hiro-o918 May 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, how about casting to ReadPickleBuffer of pandas because some method of pandas protocol seems to be too much?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, will apply in another PR.



def get_dataframe_type_from_task(task: Any) -> Literal['pandas', 'polars', 'polars-lazy']:
Expand Down