Skip to content

Commit

Permalink
Update question list parsing again
Browse files Browse the repository at this point in the history
  • Loading branch information
raunakab committed Jan 2, 2025
1 parent bf1103c commit cc76fa1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,13 @@ def parse_questions(questions: Optional[str], total_number_of_questions: int) ->
if questions is None:
return list(range(total_number_of_questions))
else:
return [int(q) for q in questions.split(",")]

def to_int(q: str) -> int:
question = int(q)
if question > total_number_of_questions:
raise ValueError(
f"Question number should be less than {total_number_of_questions}, instead got {question}"
)
return question

return [to_int(q) for q in questions.split(",")]

0 comments on commit cc76fa1

Please sign in to comment.