fix: refine details (#979)

* feat: add parquet preview and extract common DataFrame preview logic

* refactor: improve error messages, prompts, regex, and session loading

* lint
This commit is contained in:
you-n-g
2025-06-23 10:38:27 +08:00
committed by GitHub
parent a4206e99b2
commit b60f5fc506
8 changed files with 62 additions and 26 deletions
+17 -1
View File
@@ -250,7 +250,11 @@ class LoopBase:
current_step = self.step_idx[li]
self.pbar.n = current_step
next_step = self.step_idx[li] % len(self.steps)
self.pbar.set_postfix(loop_index=li, step_index=next_step, step_name=self.steps[next_step])
self.pbar.set_postfix(
loop_index=li + next_step_idx // len(self.steps),
step_index=next_step,
step_name=self.steps[next_step],
)
self._check_exit_conditions_on_step()
else:
logger.warning(f"Step forward {si} of loop {li} is skipped.")
@@ -411,6 +415,18 @@ class LoopBase:
An instance of LoopBase with the loaded session.
"""
path = Path(path)
# if the path is a directory, load the latest session
if path.is_dir():
if path.name != "__session__":
path = path / "__session__"
if not path.exists():
raise FileNotFoundError(f"No session file found in {path}")
# iterate the dump steps in increasing order
files = sorted(path.glob("*/*_*"), key=lambda f: (int(f.parent.name), int(f.name.split("_")[0])))
path = files[-1]
logger.info(f"Loading latest session from {path}")
with path.open("rb") as f:
session = cast(LoopBase, pickle.load(f))