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

Method to_dict

src/summarycode/todo.py:335–360  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

333
334
335 def to_dict(self):
336 def dict_fields(attr, value):
337 if attr.name == 'file_regions':
338 return False
339
340 if attr.name == 'detection_type':
341 return False
342
343 return True
344
345 detection_mapping = attr.asdict(self, filter=dict_fields, dict_factory=dict)
346 if self.detection_type == 'license':
347 # add rule attributes to the match details
348 matches_with_details = []
349 for license_match in detection_mapping["detection"]["matches"]:
350 license_match_obj = LicenseMatchFromResult.from_dict(license_match)
351 matches_with_details.append(
352 license_match_obj.to_dict(
353 include_text=True,
354 license_text_diagnostics=True,
355 rule_details=True,
356 )
357 )
358 detection_mapping["detection"]["matches"] = matches_with_details
359
360 return detection_mapping
361
362
363class PackageDetectionCategory(Enum):

Callers 2

process_codebaseMethod · 0.45
from_licenseMethod · 0.45

Calls 2

from_dictMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected