chore(integration): intégrer les PR Pronote critiques dans main

Revue Codex validée. Intégration dans main de la chaîne des PR #31, #32 et #33.

Co-authored-by: Codex <codex@antoineve.me>
Co-committed-by: Codex <codex@antoineve.me>
This commit was merged in pull request #35.
This commit is contained in:
2026-09-12 15:00:32 +02:00
committed by Codex
parent d45d38d365
commit 573705a3d0
10 changed files with 355 additions and 27 deletions
+6 -4
View File
@@ -35,6 +35,7 @@ from ...models.agenda import (
from ...models.homework import Homework
from ...utils.redaction import redact_exception, redact_url
from ...utils.uid import generate_deterministic_uid, normalize_pronote_uid
from .lessons import collapse_replaced_lessons
_HEADER_LABEL_PATTERN = re.compile(
r"(?P<label>Mati(?:ère|ere)|Professeur(?:s|\(s\))?|Salle(?:s|\(s\))?"
@@ -186,11 +187,12 @@ def parse_header(header: str) -> HeaderInfo:
"group": None,
"class_part": None,
}
matches = list(_HEADER_LABEL_PATTERN.finditer(header))
header_text = _strip_html(header)
matches = list(_HEADER_LABEL_PATTERN.finditer(header_text))
for index, match in enumerate(matches):
value_start = match.end()
value_end = matches[index + 1].start() if index + 1 < len(matches) else len(header)
value = unescape(header[value_start:value_end].strip())
value_end = matches[index + 1].start() if index + 1 < len(matches) else len(header_text)
value = unescape(header_text[value_start:value_end].strip())
label = _normalize_label(match.group("label")).replace("(s)", "s")
if label == "matiere":
info["subject"] = value
@@ -567,4 +569,4 @@ def parse_ical(raw_ical: str) -> tuple[list[Lesson], list[Homework], list[School
)
)
return lessons, homeworks, school_events
return collapse_replaced_lessons(lessons), homeworks, school_events