Skip to content

Commit

Permalink
Use coderabbitai suggested fill
Browse files Browse the repository at this point in the history
  • Loading branch information
roomrys committed Sep 18, 2023
1 parent f1eef11 commit c7ec0a1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions sleap/io/visuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ def reader(
)
if background != "original":
# fill the frame with the color
if background == "black":
fill = 0
elif background == "grey":
fill = 127
elif background == "white":
fill = 255
else:
raise ValueError(f"Invalid background color: {background}")
fill_values = {"black": 0, "grey": 127, "white": 255}
try:
fill = fill_values[background]
except KeyError:
raise ValueError(
f"Invalid background color: {background}. Options include: {', '.join(fill_values.keys())}"
)
video_frame_images = video_frame_images * 0 + fill

if not loaded_chunk_idxs:
Expand Down

0 comments on commit c7ec0a1

Please sign in to comment.