From 0744d1000e4bd7fe21b042dd6614a597ea45fe6d Mon Sep 17 00:00:00 2001 From: MstrPikachu <31784486+MstrPikachu@users.noreply.github.com> Date: Mon, 13 Dec 2021 14:16:31 -0500 Subject: [PATCH] Add representation invariants to collect_others.py --- src/collect_others.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/collect_others.py b/src/collect_others.py index 8a5fba0..14600be 100644 --- a/src/collect_others.py +++ b/src/collect_others.py @@ -5,6 +5,15 @@ import requests @dataclass class CasesData: + """ + A dataclass that stores a mapping of date to cases on that day and a mapping of date to deaths + on that day. + + Representation Invariants: + - all(x >= 0 for x in self.cases.values()) + - all(x >= 0 for x in self.deaths.values()) + + """ # cases[date in "YYYY-MM-DD"] = 7-day average of cases around that date cases: dict[str, float] deaths: dict[str, float]