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

Function is_candidate

src/cluecode/copyrights.py:4274–4302  ·  view source on GitHub ↗

Return True if a prepared line is a candidate line for copyright detection

(prepared_line)

Source from the content-addressed store, hash-verified

4272
4273
4274def is_candidate(prepared_line):
4275 """
4276 Return True if a prepared line is a candidate line for copyright detection
4277 """
4278 if TRACE:
4279 logger_debug(f'is_candidate: prepared_line: {prepared_line!r}')
4280
4281 if not prepared_line:
4282 return False
4283
4284 if is_only_digit_and_punct(prepared_line):
4285 if TRACE:
4286 logger_debug(f'is_candidate: is_only_digit_and_punct:\n{prepared_line!r}')
4287
4288 return False
4289
4290 if gibberish_detector.detect_gibberish(prepared_line):
4291 if TRACE:
4292 logger_debug(f'is_candidate: gibberish_detector.detect_gibberish:\n{prepared_line!r}')
4293 return False
4294
4295 if copyrights_hint.years(prepared_line):
4296 return True
4297 else:
4298 pass
4299 prepared_line = prepared_line.lower()
4300 for marker in copyrights_hint.statement_markers:
4301 if marker in prepared_line:
4302 return True
4303
4304
4305def is_inside_statement(

Callers 1

collect_candidate_linesFunction · 0.85

Calls 2

detect_gibberishMethod · 0.80
logger_debugFunction · 0.70

Tested by

no test coverage detected