Skip to content

Commit 5fde9ba

Browse files
authored
question_utils.py each long line has been split to ensure that no line exceeds 100 characters (bregman-arie#10568)
1 parent d3fd48b commit 5fde9ba

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

scripts/question_utils.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def get_file_content() -> str:
2222

2323
def get_question_list(file_content: str) -> List[str]:
2424
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+
]
2630

2731

2832
def get_answered_questions(file_content: str) -> List[str]:
@@ -31,7 +35,12 @@ def get_answered_questions(file_content: str) -> List[str]:
3135
for detail in details:
3236
summary_match = SUMMARY_PATTERN.search(detail)
3337
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+
):
3544
answered.append(summary_match.group(1))
3645
return answered
3746

@@ -56,11 +65,17 @@ def get_random_question(question_list: List[str], with_answer: bool = False) ->
5665
"""Use this question_list. Unless you have already opened/worked/need the file, then don't or
5766
you will end up doing the same thing twice.
5867
eg:
59-
#my_dir/main.py
68+
# my_dir/main.py
6069
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+
)
6278
>> 123
63-
# noqa: E501
6479
"""
6580

6681
if __name__ == "__main__":

0 commit comments

Comments
 (0)