Skip to content

Commit d4a8e26

Browse files
committed
Format files
1 parent b81476b commit d4a8e26

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sleap_nn/predict.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,15 @@ def run_inference(
510510
if video_index is not None and len(output.videos) > video_index:
511511
video = output.videos[video_index]
512512
# Get video filename and sanitize it for use in path
513-
video_name = Path(video.filename).stem if isinstance(video.filename, str) else f"video_{video_index}"
513+
video_name = (
514+
Path(video.filename).stem
515+
if isinstance(video.filename, str)
516+
else f"video_{video_index}"
517+
)
514518
# Insert video name before .predictions.slp extension
515-
output_path = base_path.parent / f"{base_path.stem}.{video_name}.predictions.slp"
519+
output_path = (
520+
base_path.parent / f"{base_path.stem}.{video_name}.predictions.slp"
521+
)
516522
else:
517523
output_path = base_path.with_suffix(".predictions.slp")
518524
output.save(Path(output_path).as_posix(), restore_original_videos=False)

tests/test_predict.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,9 @@ def test_video_index_output_path(
14541454
# The output file should contain the video name
14551455
output_file = output_files[0]
14561456
video_name = Path(labels.videos[0].filename).stem
1457-
assert video_name in output_file.stem, f"Video name '{video_name}' not found in output path '{output_file}'"
1457+
assert (
1458+
video_name in output_file.stem
1459+
), f"Video name '{video_name}' not found in output path '{output_file}'"
14581460

14591461
# Clean up
14601462
for f in output_files:

0 commit comments

Comments
 (0)