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

Method _identifier

src/licensedcode/detection.py:306–332  ·  view source on GitHub ↗

Return an unique identifier for a license detection, based on it's underlying license matches with the tokenized matched_text.

(self)

Source from the content-addressed store, hash-verified

304
305 @property
306 def _identifier(self):
307 """
308 Return an unique identifier for a license detection, based on it's
309 underlying license matches with the tokenized matched_text.
310 """
311 data = []
312 for match in self.matches:
313
314 matched_text = match.matched_text
315 if isinstance(matched_text, typing.Callable):
316 matched_text = matched_text()
317 if matched_text is None:
318 matched_text = ''
319 if not isinstance(matched_text, str):
320 matched_text = repr(matched_text)
321
322 tokenized_matched_text = tuple(query_tokenizer(matched_text))
323
324 identifier = (
325 match.rule.identifier,
326 match.score(),
327 tokenized_matched_text,
328 )
329 data.append(identifier)
330
331 # Return a uuid generated from the contents of the matches
332 return get_uuid_on_content(content=data)
333
334 @property
335 def identifier_with_expression(self):

Callers

nothing calls this directly

Calls 4

query_tokenizerFunction · 0.90
get_uuid_on_contentFunction · 0.85
scoreMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected