Serialize self to an ordered mapping.
(self)
| 91 | auths_sum['count'] = int(auths_sum['count']) |
| 92 | |
| 93 | def to_dict(self): |
| 94 | """ |
| 95 | Serialize self to an ordered mapping. |
| 96 | """ |
| 97 | filtered = [ |
| 98 | field for field in attr.fields(CopyrightTest) |
| 99 | if '_file' in field.name |
| 100 | ] |
| 101 | |
| 102 | fields_filter = attr.filters.exclude(*filtered) |
| 103 | data = attr.asdict(self, filter=fields_filter, dict_factory=dict) |
| 104 | |
| 105 | return dict([ |
| 106 | (key, value) for key, value in data.items() |
| 107 | # do not dump false and empties |
| 108 | if value |
| 109 | ]) |
| 110 | |
| 111 | def dumps(self): |
| 112 | """ |
no outgoing calls
no test coverage detected