| 291 | |
| 292 | @classmethod |
| 293 | def from_package(cls, package_data, detection_log, file_path): |
| 294 | purl = package_data["purl"] |
| 295 | if not purl: |
| 296 | purl = get_unknown_purl(package_data["type"]) |
| 297 | identifier = get_package_identifier(package_data, file_path) |
| 298 | detection_id = f"{purl}-{identifier}" |
| 299 | file_region = FileRegion( |
| 300 | path=file_path, |
| 301 | start_line=None, |
| 302 | end_line=None, |
| 303 | ) |
| 304 | review_comments = get_review_comments(detection_log) |
| 305 | return cls( |
| 306 | detection_type='package', |
| 307 | detection_id=detection_id, |
| 308 | detection=package_data, |
| 309 | review_comments=review_comments, |
| 310 | file_regions=[file_region], |
| 311 | ) |
| 312 | |
| 313 | @classmethod |
| 314 | def from_license(cls, detection, detection_log, file_regions): |