Add representation invariants to utils.py

This commit is contained in:
MstrPikachu
2021-12-13 01:34:56 -05:00
parent 1da01de3af
commit 049d594c19
+7
View File
@@ -118,6 +118,9 @@ class Reporter:
Attributes:
- report: The string of the report
- file: Where the report is stored
Representation Invariants:
- self.file != ''
"""
report: str
file: str
@@ -360,6 +363,10 @@ def divide_zeros(numerator: list[float], denominator: list[float]) -> list[float
class EnhancedJSONEncoder(json.JSONEncoder):
"""
An improvement to the json.JSONEncoder class, which supports:
encoding for dataclasses, encoding for datetime, and sets
"""
def default(self, o):
# Support encoding dataclasses