def _check_scan(self, package_version: PackageVersion, index_report: dict) -> list:
scan_report = []<EOL>hashes = []<EOL>pipenv_style_hashes = []<EOL>for entry in index_report.values():<EOL><INDENT>hashes.append([item["<STR_LIT>"] for item in entry])<EOL>pipenv_style_hashes.append([f"<STR_LIT>" for item in entry])<EOL><DEDENT>if not package_version.index and len(index_report.keys()) > <NUM_LIT:1>:<EOL><INDENT>if set(chain(*hashes)) != set(hashes[<NUM_LIT:0>]):<EOL><INDENT>sources_reported = "<STR_LIT:U+002CU+0020>".join(index_report.keys())<EOL>scan_report.append(<EOL>{<EOL>"<STR_LIT:type>": "<STR_LIT>",<EOL>"<STR_LIT:id>": "<STR_LIT>",<EOL>"<STR_LIT>": f"<STR_LIT>"<EOL>f"<STR_LIT>",<EOL>"<STR_LIT>": list(index_report.keys()),<EOL>"<STR_LIT>": package_version.to_pipfile_lock(),<EOL>"<STR_LIT>": package_version.name,<EOL>"<STR_LIT>": package_version.version,<EOL>"<STR_LIT>": index_report,<EOL>}<EOL>)<EOL><DEDENT><DEDENT>source = None<EOL>if package_version.index:<EOL><INDENT>source = package_version.index.to_dict()<EOL><DEDENT>if package_version.index and index_report.get(package_version.index.url) and len(hashes) > <NUM_LIT:1>:<EOL><INDENT>used_package_version_hashes = set(h[len("<STR_LIT>"):] for h in package_version.hashes)<EOL>configured_index_hashes = set(h["<STR_LIT>"] for h in index_report[package_version.index.url])<EOL>other_sources = {}<EOL>for artifact_hash in package_version.hashes:<EOL><INDENT>artifact_hash = artifact_hash[len("<STR_LIT>"):]  <EOL>for index_url, index_info in index_report.items():<EOL><INDENT>if index_url == package_version.index.url:<EOL><INDENT>continue<EOL><DEDENT>artifact_entry = [(i.get("<STR_LIT:name>"), i["<STR_LIT>"]) for i in index_info if i["<STR_LIT>"] == artifact_hash]<EOL>if not artifact_entry:<EOL><INDENT>continue<EOL><DEDENT>if index_url not in other_sources:<EOL><INDENT>other_sources[index_url] = []<EOL><DEDENT>other_sources[index_url].extend(artifact_entry)<EOL><DEDENT><DEDENT>if not set(used_package_version_hashes).issubset(set(configured_index_hashes)):<EOL><INDENT>scan_report.append(<EOL>{<EOL>"<STR_LIT:type>": "<STR_LIT>",<EOL>"<STR_LIT:id>": "<STR_LIT>",<EOL>"<STR_LIT>": f"<STR_LIT>"<EOL>f'<STR_LIT>',<EOL>"<STR_LIT:source>": source,<EOL>"<STR_LIT>": package_version.to_pipfile_lock(),<EOL>"<STR_LIT>": package_version.name,<EOL>"<STR_LIT>": package_version.version,<EOL>"<STR_LIT>": list(other_sources.keys()),<EOL>"<STR_LIT>": other_sources,<EOL>}<EOL>)<EOL><DEDENT>elif other_sources:<EOL><INDENT>scan_report.append(<EOL>{<EOL>"<STR_LIT:type>": "<STR_LIT>",<EOL>"<STR_LIT:id>": "<STR_LIT>",<EOL>"<STR_LIT>": f"<STR_LIT>"<EOL>f'<STR_LIT>'<EOL>f"<STR_LIT>",<EOL>"<STR_LIT:source>": source,<EOL>"<STR_LIT>": package_version.to_pipfile_lock(),<EOL>"<STR_LIT>": package_version.name,<EOL>"<STR_LIT>": package_version.version,<EOL>"<STR_LIT>": list(other_sources.keys()),<EOL>"<STR_LIT>": other_sources,<EOL>}<EOL>)<EOL><DEDENT><DEDENT>if package_version.index and not index_report.get(package_version.index.url):<EOL><INDENT>scan_report.append(<EOL>{<EOL>"<STR_LIT:type>": "<STR_LIT>",<EOL>"<STR_LIT:id>": "<STR_LIT>",<EOL>"<STR_LIT>": f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>",<EOL>"<STR_LIT:source>": source,<EOL>"<STR_LIT>": package_version.to_pipfile_lock(),<EOL>"<STR_LIT>": package_version.name,<EOL>"<STR_LIT>": package_version.version,<EOL>"<STR_LIT>": index_report,<EOL>}<EOL>)<EOL><DEDENT>for digest in package_version.hashes:<EOL><INDENT>digest = digest[len("<STR_LIT>"):]<EOL>for index_info in index_report.values():<EOL><INDENT>if any(item["<STR_LIT>"] == digest for item in index_info):<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>scan_report.append(<EOL>{<EOL>"<STR_LIT:type>": "<STR_LIT>",<EOL>"<STR_LIT:id>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT:source>": source,<EOL>"<STR_LIT>": package_version.to_pipfile_lock(),<EOL>"<STR_LIT>": package_version.name,<EOL>"<STR_LIT>": package_version.version,<EOL>"<STR_LIT>": digest,<EOL>}<EOL>)<EOL><DEDENT><DEDENT>return scan_report<EOL>
Find and report errors found in the index scan.