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

Method to_dict

src/summarycode/plugin_consolidate.py:65–86  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

63 resources = attr.ib(default=attr.Factory(list))
64
65 def to_dict(self, **kwargs):
66
67 def dict_fields(attr, value):
68 if attr.name in ('resources',):
69 return False
70 return True
71
72 license_expressions_to_combine = []
73 if self.core_license_expression:
74 license_expressions_to_combine.append(self.core_license_expression)
75 if self.other_license_expression:
76 license_expressions_to_combine.append(self.other_license_expression)
77 if license_expressions_to_combine:
78 combined_license_expression = combine_expressions(license_expressions_to_combine)
79 if combined_license_expression:
80 self.consolidated_license_expression = str(Licensing().parse(combined_license_expression).simplify())
81 self.core_holders = [h.original for h in self.core_holders]
82 self.other_holders = [h.original for h in self.other_holders]
83 self.consolidated_holders = sorted(set(self.core_holders + self.other_holders))
84 # TODO: Verify and test that we are generating detectable copyrights
85 self.consolidated_copyright = 'Copyright (c) {}'.format(', '.join(self.consolidated_holders))
86 return attr.asdict(self, filter=dict_fields, dict_factory=dict)
87
88
89@attr.s

Callers 3

to_dictMethod · 0.45
to_dictMethod · 0.45
process_codebaseMethod · 0.45

Calls 5

combine_expressionsFunction · 0.90
appendMethod · 0.45
parseMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected