From abbb951589ecd3addbc2c505bb7fb8f773b17274 Mon Sep 17 00:00:00 2001 From: surister Date: Thu, 9 Jan 2020 12:13:31 +0100 Subject: [PATCH] Rename file --- scripts/get_answered_questions.py | 60 ------------------- ....py => scripts_question_utils_unittest.py} | 0 2 files changed, 60 deletions(-) delete mode 100644 scripts/get_answered_questions.py rename tests/{scripts_get_answered_question_unittest.py => scripts_question_utils_unittest.py} (100%) diff --git a/scripts/get_answered_questions.py b/scripts/get_answered_questions.py deleted file mode 100644 index cd3bfd4..0000000 --- a/scripts/get_answered_questions.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Usage: - -$ python scripts/get_answered_questions.py - -Writes the number of answered questions to STDOUT - -""" - - -import pathlib -from sys import stdout -from typing import List - -p = pathlib.Path(__file__).parent.parent.joinpath('README.md') - -with open(p, 'rb') as f: - file_list = [line.rstrip() for line in f.readlines()] - - -def get_question_list(file_list: List[bytes]) -> list: - - questions_list = [] - temp = [] - after_summary_tag = False - - for line in file_list: - if line.startswith(b'
'): - temp.append(line) - after_summary_tag = True - - elif after_summary_tag and line != b'' and b'
' not in line: - temp.append(line) - - elif after_summary_tag and b'' in line: - temp.append(line) - after_summary_tag = False - - questions_list.append(temp) - temp = [] - - return questions_list - - -def get_answered_questions(question_list: List[List[bytes]]) -> int: - c = 0 - for q in question_list: - index = 0 - for i in q: - if b'' in i: - index = q.index(i) - if q[index+1: len(q) - 1]: - c += 1 - return c - - -if __name__ == '__main__': - question_list = get_question_list(file_list) - n_answers = get_answered_questions(question_list) - stdout.write(str(n_answers)) diff --git a/tests/scripts_get_answered_question_unittest.py b/tests/scripts_question_utils_unittest.py similarity index 100% rename from tests/scripts_get_answered_question_unittest.py rename to tests/scripts_question_utils_unittest.py