Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Brozdowski <[email protected]>
  • Loading branch information
edeno and CBroz1 authored Feb 20, 2024
1 parent b8abd47 commit 6938aaa
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/spyglass/position/v1/position_dlc_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,25 +389,18 @@ def add_video_files(
add_to_files=True,
**kwargs,
):
if add_new & (not config_path):
if not key:
raise ValueError(
"at least one of config_path or key have to be passed if add_new=True"
)
else:
config_path = (cls & key).fetch1("config_path")
if (not key) & add_to_files:
if config_path:
if len(cls & {"config_path": config_path}) == 1:
pass
else:
raise ValueError(
"Cannot set add_to_files=True without passing key"
)
else:
raise ValueError(
"Cannot set add_to_files=True without passing key"
)
has_config_or_key = bool(config_path) or bool(key)

if add_new and not has_config_or_key:
raise ValueError("If add_new, must provide key or config_path")
config_path = config_path or (cls & key).fetch1("config_path")

if (
add_to_files
and not key
and len(cls & {"config_path": config_path}) != 1
):
raise ValueError("Cannot set add_to_files=True without passing key")

if all(isinstance(n, Dict) for n in video_list):
videos_to_convert = [
Expand Down

0 comments on commit 6938aaa

Please sign in to comment.