@@ -22,7 +22,11 @@ def get_file_content() -> str:
22
22
23
23
def get_question_list (file_content : str ) -> List [str ]:
24
24
details = DETAILS_PATTERN .findall (file_content )
25
- return [SUMMARY_PATTERN .search (detail ).group (1 ) for detail in details if SUMMARY_PATTERN .search (detail )]
25
+ return [
26
+ SUMMARY_PATTERN .search (detail ).group (1 )
27
+ for detail in details
28
+ if SUMMARY_PATTERN .search (detail )
29
+ ]
26
30
27
31
28
32
def get_answered_questions (file_content : str ) -> List [str ]:
@@ -31,7 +35,12 @@ def get_answered_questions(file_content: str) -> List[str]:
31
35
for detail in details :
32
36
summary_match = SUMMARY_PATTERN .search (detail )
33
37
b_match = B_PATTERN .search (detail )
34
- if summary_match and b_match and summary_match .group (1 ).strip () and b_match .group (1 ).strip ():
38
+ if (
39
+ summary_match
40
+ and b_match
41
+ and summary_match .group (1 ).strip ()
42
+ and b_match .group (1 ).strip ()
43
+ ):
35
44
answered .append (summary_match .group (1 ))
36
45
return answered
37
46
@@ -56,11 +65,17 @@ def get_random_question(question_list: List[str], with_answer: bool = False) ->
56
65
"""Use this question_list. Unless you have already opened/worked/need the file, then don't or
57
66
you will end up doing the same thing twice.
58
67
eg:
59
- #my_dir/main.py
68
+ # my_dir/main.py
60
69
from scripts import question_utils
61
- print(question_utils.get_answered_questions(question_utils.get_question_list(question_utils.get_file_content()))
70
+
71
+ print(
72
+ question_utils.get_answered_questions(
73
+ question_utils.get_question_list(
74
+ question_utils.get_file_content()
75
+ )
76
+ )
77
+ )
62
78
>> 123
63
- # noqa: E501
64
79
"""
65
80
66
81
if __name__ == "__main__" :
0 commit comments