(self, o: object)
| 155 | |
| 156 | class JSONEncoder(json.JSONEncoder): |
| 157 | def default(self, o: object): |
| 158 | if isinstance(o, Serializable): |
| 159 | return o.jsonable() |
| 160 | if dataclasses.is_dataclass(o): |
| 161 | return dataclasses.asdict(o) |
| 162 | if isinstance(o, set): |
| 163 | return tuple(o) |
| 164 | if isinstance(o, Path): |
| 165 | return str(o) |
| 166 | if isinstance(o, Exception): |
| 167 | return str(o) |
| 168 | return super().default(o) |
no test coverage detected