Skip to content

Commit

Permalink
🧹 linted code
Browse files Browse the repository at this point in the history
  • Loading branch information
gy-mate committed Jul 20, 2024
1 parent 9dc7a52 commit b8d5608
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/moodle_to_vikwikiquiz/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ def __init__(
) -> None:
assert isinstance(q_type, QuestionType)
self.q_type = q_type

assert isinstance(text, str)
self.text = text

assert isinstance(illustration, bool)
self.illustration = illustration

assert isinstance(answers, list)
assert answers
self.answers = answers

assert isinstance(correct_answers, set)
assert correct_answers
self.correct_answers = correct_answers

if grading:
assert isinstance(grading, GradingType)
self.grading = grading
Expand Down
14 changes: 7 additions & 7 deletions src/moodle_to_vikwikiquiz/quiz_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_answers(
answer_text = prettify(answer_text)
answer_texts.append(answer_text)
if answer_is_correct(
answer, answer_text, grade, maximum_points, correct_answers
answer, answer_text, grade, maximum_points, correct_answers
):
id_of_correct_answers.add(i)
i += 1
Expand All @@ -192,7 +192,7 @@ def get_correct_answers_if_provided(question: Tag) -> set[str | None]:
assert isinstance(tag, Tag)
hint_text = prettify(tag.text)
if only_correct_answer := re.findall(
r"(?<=The correct answer is: ).+", hint_text
r"(?<=The correct answer is: ).+", hint_text
):
assert only_correct_answer
prettified_answer = prettify(only_correct_answer[0])
Expand All @@ -212,11 +212,11 @@ def get_correct_answers_if_provided(question: Tag) -> set[str | None]:


def answer_is_correct(
answer: Tag,
answer_text: str,
grade: float,
maximum_points: float,
correct_answers: set[str | None],
answer: Tag,
answer_text: str,
grade: float,
maximum_points: float,
correct_answers: set[str | None],
) -> bool:
if correct_answers and answer_text in correct_answers:
return True
Expand Down

0 comments on commit b8d5608

Please sign in to comment.