(cls, json_str)
| 21 | |
| 22 | @classmethod |
| 23 | def from_json(cls, json_str): |
| 24 | data = cls.deserialize(json_str) |
| 25 | |
| 26 | if not isinstance(data, dict): |
| 27 | raise ValueError("data should be dict") |
| 28 | |
| 29 | return cls(**data) |
| 30 | |
| 31 | |
| 32 | class DatetimeDecimalEncoder(json.JSONEncoder): |