MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / to_dict

Method to_dict

tests/cluecode/cluecode_test_utils.py:93–109  ·  view source on GitHub ↗

Serialize self to an ordered mapping.

(self)

Source from the content-addressed store, hash-verified

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 """

Calls

no outgoing calls

Tested by

no test coverage detected