Return an unique identifier for a license detection, based on it's underlying license matches with the tokenized matched_text.
(self)
| 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): |
nothing calls this directly
no test coverage detected