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

Method _unique_id

src/licensedcode/models.py:2722–2731  ·  view source on GitHub ↗

Return a computed unique id string based on this rule content. This is used to compute unique identifiers for synthetic rules. (This is a SHA1 checksum of the expression and text, but this is an implementation detail)

(self)

Source from the content-addressed store, hash-verified

2720
2721 @property
2722 def _unique_id(self):
2723 """
2724 Return a computed unique id string based on this rule content.
2725
2726 This is used to compute unique identifiers for synthetic rules.
2727 (This is a SHA1 checksum of the expression and text, but this is an
2728 implementation detail)
2729 """
2730 content = f'{self.license_expression!r}{self.text!r}'
2731 return sha1(content.encode('utf-8')).hexdigest()
2732
2733 def load(self):
2734 raise NotImplementedError

Callers

nothing calls this directly

Calls 3

sha1Function · 0.85
hexdigestMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected