Skip to content

Commit

Permalink
Set optional "travailAFaire" and "documentsTAF" for punishments (#314)
Browse files Browse the repository at this point in the history
Co-authored-by: bain <bain@bain.cz>
  • Loading branch information
ioull and bain3 authored Oct 15, 2024
1 parent 3be3815 commit 1cb2833
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pronotepy/dataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,7 +1996,7 @@ class Punishment(Object):
exclusion (bool): If the punishment is an exclusion from class
during_lesson (bool): If the punishment was given during a lesson.
`self.during_lesson is True => self.given is datetime.datetime`
homework (str): Text description of the homework that was given as the punishment
homework (Optional[str]): Text description of the homework that was given as the punishment
homework_documents (List[Attachment]): Attached documents for homework
circumstances (str)
circumstance_documents (List[Attachment])
Expand Down Expand Up @@ -2071,9 +2071,12 @@ def __init__(self, client: ClientBase, json_dict: dict) -> None:

self.exclusion: bool = self._resolver(bool, "estUneExclusion")

self.homework: str = self._resolver(str, "travailAFaire")
self.homework: str = self._resolver(str, "travailAFaire", strict=False)
self.homework_documents: List[Attachment] = self._resolver(
lambda x: [Attachment(client, a) for a in x], "documentsTAF", "V"
lambda x: [Attachment(client, a) for a in x],
"documentsTAF",
"V",
default=[],
)

self.circumstances: str = self._resolver(str, "circonstances")
Expand Down

0 comments on commit 1cb2833

Please sign in to comment.