Skip to content

Commit c787f09

Browse files
committed
use pathlib api
1 parent 78a001b commit c787f09

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/python/release_checklist/check_lerobot_v2_dataloader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

3-
import os
43
from argparse import Namespace
4+
from pathlib import Path
55

66
import rerun as rr
77
from huggingface_hub import snapshot_download
@@ -21,18 +21,18 @@ def run(args: Namespace) -> None:
2121
# That means the `recording_id` needs to be set to "episode_0", otherwise the LeRobot dataloader
2222
# will create a new recording for episode 0, instead of merging it into the existing recording.
2323
# If you don't set it, you'll end up with 4 recordings, an empty one and the 3 episodes.
24-
rec = rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id="episode_0")
24+
rec = rr.script_setup(args, f"{Path(__file__).name}", recording_id="episode_0")
2525

2626
# load dataset from huggingface
27-
dataset_path = os.path.dirname(__file__) + "/.datasets/v21_apple_storage"
27+
dataset_path = Path(__file__).parent / ".datasets" / "v21_apple_storage"
2828
snapshot_download(repo_id="rerun/v21_apple_storage", local_dir=dataset_path, repo_type="dataset")
2929

3030
rec.log_file_from_path(dataset_path)
3131

3232
# NOTE: This dataloader works by creating a new recording for each episode.
3333
# So that means we need to log the README to each recording.
3434
for i in range(3):
35-
rec = rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=f"episode_{i}")
35+
rec = rr.script_setup(args, f"{Path(__file__).name}", recording_id=f"episode_{i}")
3636
rec.set_time("frame_index", sequence=0)
3737
rec.log("/readme", rr.TextDocument(README), static=True)
3838

tests/python/release_checklist/check_lerobot_v3_dataloader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

3-
import os
43
from argparse import Namespace
4+
from pathlib import Path
55

66
import rerun as rr
77
from huggingface_hub import snapshot_download
@@ -21,18 +21,18 @@ def run(args: Namespace) -> None:
2121
# That means the `recording_id` needs to be set to "episode_0", otherwise the LeRobot dataloader
2222
# will create a new recording for episode 0, instead of merging it into the existing recording.
2323
# If you don't set it, you'll end up with 4 recordings, an empty one and the 3 episodes.
24-
rec = rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id="episode_0")
24+
rec = rr.script_setup(args, f"{Path(__file__).name}", recording_id="episode_0")
2525

2626
# load dataset from huggingface
27-
dataset_path = os.path.dirname(__file__) + "/.datasets/v30_apple_storage"
27+
dataset_path = Path(__file__).parent / ".datasets" / "v30_apple_storage"
2828
snapshot_download(repo_id="rerun/v30_apple_storage", local_dir=dataset_path, repo_type="dataset")
2929

3030
rec.log_file_from_path(dataset_path)
3131

3232
# NOTE: This dataloader works by creating a new recording for each episode.
3333
# So that means we need to log the README to each recording.
3434
for i in range(3):
35-
rec = rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=f"episode_{i}")
35+
rec = rr.script_setup(args, f"{Path(__file__).name}", recording_id=f"episode_{i}")
3636
rec.set_time("frame_index", sequence=0)
3737
rec.log("/readme", rr.TextDocument(README), static=True)
3838

0 commit comments

Comments
 (0)