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

Function populate_matches_with_path

src/licensedcode/detection.py:721–733  ·  view source on GitHub ↗

Given `matches` list of LicenseMatch objects, populate the `from_file` attribute in them with `path` which is the path for the origin file for that license match.

(matches, path)

Source from the content-addressed store, hash-verified

719
720
721def populate_matches_with_path(matches, path):
722 """
723 Given `matches` list of LicenseMatch objects, populate the `from_file`
724 attribute in them with `path` which is the path for the origin file for
725 that license match.
726 """
727 for match in matches:
728 # Here if we have the `from_file` attribute populated already,
729 # they are from other files, and if it's empty, they are from
730 # the original resource, so we populate the files with the resource
731 # path for the original resource of their origin
732 if not match["from_file"]:
733 match["from_file"] = path
734
735
736def collect_license_detections(codebase, include_license_clues=True):

Calls

no outgoing calls

Tested by

no test coverage detected