def peep_install(argv):
    """Perform the ``peep install`` subcommand, returning a shell status code
    or raising a PipException.

    :arg argv: The commandline args, starting after the subcommand

    """
    req_paths = list(requirement_args(argv, want_paths=True))
    if not req_paths:
        print("You have to specify one or more requirements files with the -r option, because")
        print("otherwise there's nowhere for peep to look up the hashes.")
        return COMMAND_LINE_ERROR

    # We're a "peep install" command, and we have some requirement paths.
    requirements = list(chain(*(parse_requirements(path,
                                                   options=EmptyOptions())
                                for path in req_paths)))
    downloaded_hashes, downloaded_versions, satisfied_reqs, malformed_reqs = {}, {}, [], []

    with ephemeral_dir() as temp_path:
        for req in requirements:
            if not req.req or not req.req.project_name:
                malformed_reqs.append('Unable to determine package name from URL %s; add #egg=' % req.url)
                continue

            req.check_if_exists()
            if req.satisfied_by and not is_always_unsatisfied(req):
                # This is already installed or we don't know the
                # version number from the requirement line, so we can
                # never know if this is satisfied.
                satisfied_reqs.append(req)
            else:
                name = req.req.project_name  # unsafe name
                archive_filename = pip_download(req, argv, temp_path)
                downloaded_hashes[name] = hash_of_file(join(temp_path, archive_filename))
                downloaded_versions[name] = version_of_download(archive_filename, name)

        expected_hashes, missing_hashes_reqs = hashes_of_requirements(requirements)
        mismatches = list(hash_mismatches(expected_hashes, downloaded_hashes))

        # Remove satisfied_reqs from missing_hashes, preserving order:
        satisfied_req_names = set(req.name for req in satisfied_reqs)
        missing_hashes_reqs = [req for req in missing_hashes_reqs if req.name not in satisfied_req_names]

        # Skip a line after pip's "Cleaning up..." so the important stuff
        # stands out:
        if mismatches or missing_hashes_reqs or malformed_reqs:
            print()

        # Mismatched hashes:
        if mismatches:
            print("THE FOLLOWING PACKAGES DIDN'T MATCH THE HASHES SPECIFIED IN THE REQUIREMENTS")
            print("FILE. If you have updated the package versions, update the hashes. If not,")
            print("freak out, because someone has tampered with the packages.\n")
        for expected_hashes, package_name, hash_of_download in mismatches:
            hash_of_download = downloaded_hashes[package_name]
            preamble = '    %s: expected%s' % (
                    package_name,
                    ' one of' if len(expected_hashes) > 1 else '')
            print(preamble, end=' ')
            print(('\n' + ' ' * (len(preamble) + 1)).join(expected_hashes))
            print(' ' * (len(preamble) - 4), 'got', hash_of_download)
        if mismatches:
            print()  # Skip a line before "Not proceeding..."

        # Missing hashes:
        if missing_hashes_reqs:
            print('The following packages had no hashes specified in the requirements file, which')
            print('leaves them open to tampering. Vet these packages to your satisfaction, then')
            print('add these "sha256" lines like so:\n')
        for req in missing_hashes_reqs:
            print('# sha256: %s' % downloaded_hashes[req.name])
            if req.url:
                line = req.url
                if req.name not in filename_from_url(req.url):
                    line = (line, req.name) % '%s#egg=%s'
            else:
                line = '%s==%s' % (req.name, downloaded_versions[req.name])
            print(line + '\n')

        if malformed_reqs:
            print('The following requirements could not be processed:')
            print('*', '\n* '.join(malformed_reqs))

        if mismatches or missing_hashes_reqs or malformed_reqs:
            print('-------------------------------')
            print('Not proceeding to installation.')
            return SOMETHING_WENT_WRONG
        else:
            print('---------')
            print('All hashes look good, proceeding to installation.')
            pip_install_archives_from(temp_path)

            if satisfied_reqs:
                print("These packages were already installed, so we didn't need to download or build")
                print("them again. If you installed them with peep in the first place, you should be")
                print("safe. If not, uninstall them, then re-attempt your install with peep.")
                for req in satisfied_reqs:
                    print('   ', req.req)

    return ITS_FINE_ITS_FINE
dataset/ETHPy150Open warner/petmail/support/peep.py/peep_install/swapped operands of `%`