|
@@ -17,12 +17,12 @@ from string import punctuation
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
|
# проверяемая директория
|
|
|
# LECTION_DIR = os.path.join("ЭАСвЗИ", "Лекции")
|
|
|
-LECTION_DIR = os.path.join("ТЗИ", "Лекции", "ПМ3.2")
|
|
|
+LECTION_DIR = os.path.join("TZI", "Лекции", "ПМ3.2")
|
|
|
|
|
|
# кого проверяем
|
|
|
who = "Савкин"
|
|
|
# ссылка для проверки
|
|
|
-url = "http://213.155.192.79:3001/ypv/up/src/master/%D0%A2%D0%97%D0%98/%D0%9B%D0%B5%D0%BA%D1%86%D0%B8%D0%B8/%D0%9F%D0%9C3.2/1.1.200_%D0%A1%D0%BE%D0%B4%D0%B5%D1%80%D0%B6%D0%B0%D0%BD%D0%B8%D0%B5_%D0%B8_%D0%B7%D0%B0%D0%B4%D0%B0%D1%87%D0%B8_%D1%84%D0%B8%D0%B7%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B9_%D0%B7%D0%B0%D1%89%D0%B8%D1%82%D1%8B_%D0%BE%D0%B1%D1%8A%D0%B5%D0%BA%D1%82%D0%BE%D0%B2_%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D0%B8/README.md"
|
|
|
+url = "http://213.155.192.79:3001/u19-23shapovalov/TZI/raw/eb4761181cbd2b696e987846dc9c021c146273a9/%d0%9b%d0%b5%d0%ba%d1%86%d0%b8%d0%b8/%d0%9f%d0%9c3.2/2.2.300_%d0%a1%d1%82%d1%80%d1%83%d0%ba%d1%82%d1%83%d1%80%d0%b0_%d0%b8_%d1%81%d0%be%d1%81%d1%82%d0%b0%d0%b2_%d0%a1%d0%9a%d0%a3%d0%94/README.md"
|
|
|
|
|
|
# ------------------------------- / НАСТРОЙКИ ------------
|
|
|
|
|
@@ -74,7 +74,7 @@ print()
|
|
|
|
|
|
now = datetime.datetime.now().strftime('%d-%m-%Y %H:%M')
|
|
|
out_str = f"Проверка: {who}, время проверки: {now} \n"
|
|
|
-print(out_str)
|
|
|
+# print(out_str)
|
|
|
|
|
|
response = requests.get(url)
|
|
|
post_html = response.text
|
|
@@ -82,18 +82,20 @@ post_html = response.text
|
|
|
post_list = post_html.split("\n")
|
|
|
|
|
|
# проверяем правильность оформления 1й строки
|
|
|
+header_exist = True
|
|
|
line_1 = post_list[0]
|
|
|
-if (line_1[0]) != "#":
|
|
|
+if (line_1[0:2]) != "# ":
|
|
|
print("Заголовок статьи не найден")
|
|
|
+ header_exist = False
|
|
|
|
|
|
# наличие вопросов и списка литературы
|
|
|
quest_exist = False
|
|
|
source_exist = False
|
|
|
for post_line in post_list:
|
|
|
- if (post_line[0:1] == "##"):
|
|
|
+ if (post_line[0:2] == "##"):
|
|
|
if ("Вопросы" in post_line):
|
|
|
quest_exist = True
|
|
|
- if ("Список литературы" in post_line):
|
|
|
+ if ("Список" in post_line) and ("литературы" in post_line):
|
|
|
source_exist = True
|
|
|
if not (quest_exist):
|
|
|
print("Вопросы не найдены")
|
|
@@ -115,6 +117,8 @@ except:
|
|
|
readme_html = f.read()
|
|
|
|
|
|
lection_exist = False
|
|
|
+variants_exist = False
|
|
|
+in_lections = False # начало поиска вариантов
|
|
|
readme_list = readme_html.split("\n")
|
|
|
for readme_str in readme_list:
|
|
|
readme_str = readme_str.strip()
|
|
@@ -126,6 +130,7 @@ for readme_str in readme_list:
|
|
|
if (str(name_str) == str(header_text)):
|
|
|
print("Лекция найдена")
|
|
|
lection_exist = True
|
|
|
+ in_lections = True
|
|
|
|
|
|
post_tokens, post_uniq_text = preprocess_text(post_html)
|
|
|
print(f"количество уникальных слов: {len(set(post_tokens))}")
|
|
@@ -136,10 +141,11 @@ for readme_str in readme_list:
|
|
|
# ищем конец списка вариантов лекций (пустая строка)
|
|
|
if lection_exist:
|
|
|
if (readme_str == ""):
|
|
|
- lection_exist = False
|
|
|
+ in_lections = False
|
|
|
|
|
|
# следующие после названия лекции строки
|
|
|
- if lection_exist and (str(name_str) != str(header_text)):
|
|
|
+ if in_lections and (str(name_str) != str(header_text)):
|
|
|
+ variants_exist = True
|
|
|
variant_name, t = readme_str.split("]")
|
|
|
variant_name = variant_name.strip("[")
|
|
|
print(f"проверяю {variant_name}")
|
|
@@ -166,6 +172,8 @@ for readme_str in readme_list:
|
|
|
|
|
|
if not(lection_exist):
|
|
|
print("Лекция не найдена в списке")
|
|
|
+if not(variants_exist):
|
|
|
+ print("Вариантов не найдено")
|
|
|
|
|
|
|
|
|
exit()
|