From 5fde9ba3d3b90caa12774d236fb1fbad7cf81005 Mon Sep 17 00:00:00 2001 From: Adam Djellouli <37275728+djeada@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:35:49 +0200 Subject: [PATCH] question_utils.py each long line has been split to ensure that no line exceeds 100 characters (#10568) --- scripts/question_utils.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/question_utils.py b/scripts/question_utils.py index a51fc33..830a085 100644 --- a/scripts/question_utils.py +++ b/scripts/question_utils.py @@ -22,7 +22,11 @@ def get_file_content() -> str: def get_question_list(file_content: str) -> List[str]: details = DETAILS_PATTERN.findall(file_content) - return [SUMMARY_PATTERN.search(detail).group(1) for detail in details if SUMMARY_PATTERN.search(detail)] + return [ + SUMMARY_PATTERN.search(detail).group(1) + for detail in details + if SUMMARY_PATTERN.search(detail) + ] def get_answered_questions(file_content: str) -> List[str]: @@ -31,7 +35,12 @@ def get_answered_questions(file_content: str) -> List[str]: for detail in details: summary_match = SUMMARY_PATTERN.search(detail) b_match = B_PATTERN.search(detail) - if summary_match and b_match and summary_match.group(1).strip() and b_match.group(1).strip(): + if ( + summary_match + and b_match + and summary_match.group(1).strip() + and b_match.group(1).strip() + ): answered.append(summary_match.group(1)) return answered @@ -56,11 +65,17 @@ def get_random_question(question_list: List[str], with_answer: bool = False) -> """Use this question_list. Unless you have already opened/worked/need the file, then don't or you will end up doing the same thing twice. eg: -#my_dir/main.py +# my_dir/main.py from scripts import question_utils -print(question_utils.get_answered_questions(question_utils.get_question_list(question_utils.get_file_content())) + +print( + question_utils.get_answered_questions( + question_utils.get_question_list( + question_utils.get_file_content() + ) + ) +) >> 123 - # noqa: E501 """ if __name__ == "__main__":