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

Method split

src/cluecode/copyrights.py:458–476  ·  view source on GitHub ↗

Return a list of CopyrightDetection, a list of HolderDetection and a list of AuthorDetection given a ``detections`` list of Detection. If ``to_dict`` is True, return lists of mappings instead of objects.

(cls, detections, to_dict=False)

Source from the content-addressed store, hash-verified

456
457 @classmethod
458 def split(cls, detections, to_dict=False):
459 """
460 Return a list of CopyrightDetection, a list of HolderDetection and a
461 list of AuthorDetection given a ``detections`` list of Detection.
462 If ``to_dict`` is True, return lists of mappings instead of objects.
463 """
464 copyrights = []
465 holders = []
466 authors = []
467
468 for detection in detections:
469 det = detection.to_dict() if to_dict else detection
470 if isinstance(detection, CopyrightDetection):
471 copyrights.append(det)
472 elif isinstance(detection, HolderDetection):
473 holders.append(det)
474 elif isinstance(detection, AuthorDetection):
475 authors.append(det)
476 return copyrights, holders, authors
477
478 @classmethod
479 def split_values(cls, detections):

Callers 15

from_filenameMethod · 0.45
from_pyver_and_osMethod · 0.45
check_aboutFunction · 0.45
timestampFunction · 0.45
create_copyright_testsFunction · 0.45
split_reqFunction · 0.45
clean_textFunction · 0.45
merge_licensesFunction · 0.45
cliFunction · 0.45
normalizeMethod · 0.45
strip_prefixesFunction · 0.45

Calls 2

to_dictMethod · 0.45
appendMethod · 0.45