(obj)
| 45 | |
| 46 | |
| 47 | def _clean(obj): |
| 48 | |
| 49 | if isinstance(obj, list): |
| 50 | return [_clean(item) for item in obj] |
| 51 | |
| 52 | if isinstance(obj, dict): |
| 53 | return { |
| 54 | k: _clean(v) |
| 55 | for k, v in obj.items() |
| 56 | if v is not None |
| 57 | } |
| 58 | |
| 59 | if hasattr(obj, "__dict__"): |
| 60 | return { |
| 61 | k: _clean(v) |
| 62 | for k, v in obj.__dict__.items() |
| 63 | if v is not None |
| 64 | } |
| 65 | |
| 66 | return obj |
| 67 | |
| 68 | |
| 69 | class Reporter: |