Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⌚ Add delays #198

Merged
merged 3 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
🖼️ Re-formatted (Black)
  • Loading branch information
lucas-luchack committed Jan 11, 2023
commit 0a3aeb8c65e77cf9355b75c6e65e9d5b962f8eb6
15 changes: 8 additions & 7 deletions pronotepy/dataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ def __init__(self, json_dict: dict) -> None:
)

del self._resolver



class Delay(Object):
"""
Represents a delay with a given period. You shouldn't have to create this class manually.
Expand All @@ -348,17 +349,17 @@ class Delay(Object):
justification (str): the justification for the delay
reasons (List[str]): The reason(s) for the delay
"""

def __init__(self, json_dict: dict) -> None:
super().__init__(json_dict)

self.id: str = self._resolver(str, "N")
self.date: datetime.datetime = self._resolver(
Util.datetime_parse, "date", "V"
)
self.date: datetime.datetime = self._resolver(Util.datetime_parse, "date", "V")
self.minutes: int = self._resolver(int, "duree", default=0)
self.justified: bool = self._resolver(bool, "justifie", default=False)
self.justification: Optional[str] = self._resolver(str, "justification", strict=False)
self.justification: Optional[str] = self._resolver(
str, "justification", strict=False
)
self.reasons: List[str] = self._resolver(
lambda l: [i["L"] for i in l], "listeMotifs", "V", default=[]
)
Expand Down Expand Up @@ -473,7 +474,7 @@ def absences(self) -> List[Absence]:
response = self._client.post("PagePresence", 19, json_data)
absences = response["donneesSec"]["donnees"]["listeAbsences"]["V"]
return [Absence(a) for a in absences if a["G"] == 13]

@property
def delays(self) -> List[Delay]:
"""
Expand Down
2 changes: 1 addition & 1 deletion pronotepy/test_pronotepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_absences(self) -> None:
for period in client.periods:
all_absences.extend(period.absences)
self.assertGreater(len(all_absences), 0)

def test_delays(self) -> None:
all_delays = []
for period in client.periods:
Expand Down