Skip to content

Commit 6a5d7eb

Browse files
authored
refactor duplicate cliplabels suffix error
1 parent b751e24 commit 6a5d7eb

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

poseinterface/clips.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
BOTO3_AVAILABLE = False
1818

1919

20+
def _cliplabels_suffix_error(name: str) -> str:
21+
return f"Input file must end with '_cliplabels.json', got {name}"
22+
23+
2024
def extract_clip(
2125
video_path: str | Path,
2226
start_frame: int,
@@ -218,10 +222,7 @@ def extract_start_frames_label(cliplabels_path: str | Path) -> Path:
218222

219223
# Validate input filename
220224
if not cliplabels_path.name.endswith("_cliplabels.json"):
221-
raise ValueError(
222-
"Input file must end with '_cliplabels.json', "
223-
f"got {cliplabels_path.name}"
224-
)
225+
raise ValueError(_cliplabels_suffix_error(cliplabels_path.name))
225226

226227
# Read the cliplabels file
227228
with open(cliplabels_path) as f:
@@ -316,9 +317,7 @@ def extract_start_frames_label_s3(
316317

317318
# Validate filename
318319
if not key.endswith("_cliplabels.json"):
319-
raise ValueError(
320-
f"Input file must end with '_cliplabels.json', got {key}"
321-
)
320+
raise ValueError(_cliplabels_suffix_error(key))
322321

323322
# Initialize S3 client
324323
session = boto3.Session(profile_name=aws_profile)

0 commit comments

Comments
 (0)