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

Function get_uuid_on_content

src/licensedcode/detection.py:513–520  ·  view source on GitHub ↗

Return an UUID based on the contents of a list, which should be a list of hashable elements.

(content)

Source from the content-addressed store, hash-verified

511
512
513def get_uuid_on_content(content):
514 """
515 Return an UUID based on the contents of a list, which should be
516 a list of hashable elements.
517 """
518 identifier_string = repr(tuple(content))
519 md_hash = sha1(identifier_string.encode('utf-8'))
520 return str(uuid.UUID(hex=md_hash.hexdigest()[:32]))
521
522
523@attr.s

Callers 3

get_package_identifierFunction · 0.90
_identifierMethod · 0.85

Calls 3

sha1Function · 0.85
hexdigestMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected