Skip to content

Commit

Permalink
Better type checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-Stragier committed Jun 23, 2023
1 parent 1506a67 commit 1a3e869
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions deepface/DeepFace.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,17 +296,17 @@ def analyze(
if isinstance(actions, str):
actions = (actions,)

actions = list(actions)

# Check if actions have been passed correctly
if not actions:
# check if actions is not an iterable or empty.
if not hasattr(actions, "__getitem__") or not actions:
raise ValueError("`actions` must be a list of strings.")

actions = list(actions)

# For each action, check if it is valid
for action in actions:
if action not in ("emotion", "age", "gender", "race"):
raise ValueError(
f"Invalid action passed ({action})). "
f"Invalid action passed ({repr(action)})). "
"Valid actions are `emotion`, `age`, `gender`, `race`."
)
# ---------------------------------
Expand Down

0 comments on commit 1a3e869

Please sign in to comment.