Co-authored-by: Codex/gpt-5.6-terra <codex-gpt-5-6-terra@agents.invalid>
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""Étape d'appel à la synchronisation CalDAV."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
from pronote_sync.config.settings import Settings
|
|
from pronote_sync.models.pronote import PronoteData
|
|
from pronote_sync.models.sync import CalDAVSyncResult
|
|
|
|
|
|
class CalDAVSynchronizer(Protocol):
|
|
"""Protocole injectable de synchronisation CalDAV."""
|
|
|
|
def __call__(self, data: PronoteData, settings: Settings) -> CalDAVSyncResult:
|
|
"""Synchronise les données Pronote vers CalDAV.
|
|
|
|
:param data: Données Pronote normalisées.
|
|
:param settings: Configuration effective de l'exécution.
|
|
:return: Résultat de la synchronisation.
|
|
:rtype: CalDAVSyncResult
|
|
"""
|
|
...
|
|
|
|
|
|
def caldav_sync_step(
|
|
synchronizer: CalDAVSynchronizer, data: PronoteData, settings: Settings
|
|
) -> CalDAVSyncResult:
|
|
"""Exécute la synchronisation CalDAV injectée.
|
|
|
|
:param synchronizer: Service de synchronisation injecté.
|
|
:param data: Données Pronote normalisées.
|
|
:param settings: Configuration effective de l'exécution.
|
|
:return: Résultat CalDAV.
|
|
:rtype: CalDAVSyncResult
|
|
"""
|
|
return synchronizer(data, settings)
|