diff --git a/.idea/CourseInformer.iml b/.idea/CourseInformer.iml
index 81b1652..d18eba4 100644
--- a/.idea/CourseInformer.iml
+++ b/.idea/CourseInformer.iml
@@ -4,10 +4,11 @@
-
+
-
-
+
+
+
\ No newline at end of file
diff --git a/informer.py b/informer.py
index 6d001e3..3231af7 100644
--- a/informer.py
+++ b/informer.py
@@ -25,11 +25,12 @@ curl -s -o /dev/null -X POST http://127.0.0.1:3000/send_private_msg \
定义方法publish_info负责推送,该类只暴露publish_info方法,如果涉及其他方法以及字段,均需要以`_`开头进行私有化
"""
+import json
+import os
from dataclasses import dataclass
from datetime import datetime
-import json
+
import requests
-import os
@dataclass
diff --git a/main.py b/main.py
index 31c25ae..b598d58 100644
--- a/main.py
+++ b/main.py
@@ -42,12 +42,11 @@
通知将在合适时间发送,可使用时间轮算法完成周、日的课程安排,但需要先对reader返回的课程时间进行解析。该脚本将持续运行并检测安排,在合适的时间发送通知
"""
-import time
import datetime
-from typing import List
-import reader
-import informer
+import time
+import informer
+import reader
# 课程时间安排
CLASS_SCHEDULE = {
@@ -102,7 +101,7 @@ def _get_current_week(start_date: datetime.date = datetime.date(2025, 8, 25)) ->
today = datetime.date.today()
delta = today - start_date
week = delta.days // 7 + 1
- return max(week, 1) # 确保至少为第1周
+ return week # 确保至少为第1周
def _get_notification_time(period: str, timeslot_from: int) -> str:
@@ -290,37 +289,37 @@ def _test_day_notifications(courses, current_week: int, current_day: str, day_na
# _send_course_notification(course, course.period)
-def test_notification_logic():
+def _test_notification_logic():
"""测试方法:模拟第一周第一天、第二天、第三天的课程安排通知逻辑"""
print("开始测试通知逻辑...")
-
+
try:
# 读取课程信息
student_info, courses = reader.read_course_schedule()
print(f"已读取 {len(courses)} 门课程信息")
-
+
# 模拟第一周
current_week = 1
print(f"模拟第 {current_week} 周")
-
+
# 测试第一天(星期一)
_test_day_notifications(courses, current_week, "星期一", "第一天(星期一)")
-
+
# 测试第二天(星期二)
_test_day_notifications(courses, current_week, "星期二", "第二天(星期二)")
-
+
# 测试第三天(星期三)
_test_day_notifications(courses, current_week, "星期三", "第三天(星期三)")
-
+
print("\n测试完成")
-
+
except Exception as e:
print(f"测试过程中出错: {e}")
if __name__ == "__main__":
# 运行测试方法
- test_notification_logic()
-
+ # _test_notification_logic()
+
# 如果要运行主方法,取消下面的注释
- # main()
\ No newline at end of file
+ main()
\ No newline at end of file
diff --git a/reader.py b/reader.py
index 8c9f75d..161ee53 100644
--- a/reader.py
+++ b/reader.py
@@ -2,10 +2,11 @@
Module for reading course schedule information from HTML file
"""
-from dataclasses import dataclass
-from typing import List
import os
import re
+from dataclasses import dataclass
+from typing import List
+
from bs4 import BeautifulSoup
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 3e88107..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-beautifulsoup4>=4.13.4
-requests>=2.32.5
\ No newline at end of file