mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2026-02-04 15:49:11 +00:00
question_utils.py each long line has been split to ensure that no line exceeds 100 characters (#10568)
This commit is contained in:
parent
d3fd48bd84
commit
5fde9ba3d3
@ -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
|
||||
|
||||
@ -58,9 +67,15 @@ you will end up doing the same thing twice.
|
||||
eg:
|
||||
# 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__":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user