capybara/virtualenv/lib/python2.7/site-packages/pip/download.py
def _check_download_dir(link, download_dir):
    """ Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
    """
    download_path = os.path.join(download_dir, link.filename)
    if os.path.exists(download_path):
        # If already downloaded, does its hash match?
        logger.info('File was already downloaded %s', download_path)
        if link.hash:
            download_hash = _get_hash_from_file(download_path, link)
            try:
                _check_hash(download_hash, link)
            except HashMismatch:
                logger.warning(
                    'Previously-downloaded file %s has bad hash, '
                    're-downloading.',
                    download_path
                )
                os.unlink(download_path)
                return None
        return download_path
    return None
def _check_download_dir(link, download_dir):
    download_path = os.path.join(download_dir, link.filename)
    if os.path.exists(download_path):
        # If already downloaded, does its hash match?
        logger.info('File was already downloaded %s', download_path)
        if link.hash:
            download_hash = _get_hash_from_file(download_path, link)
            try:
                _check_hash(download_hash, link)
            except HashMismatch:
                logger.warning(
                    'Previously-downloaded file %s has bad hash, '
                    're-downloading.',
                    download_path
                )
                os.unlink(download_path)
                return None
        return download_path
    return None
def _check_download_dir ( link , download_dir ) : download_path = os . path . join ( download_dir , link . filename ) if os . path . exists ( download_path ) : # If already downloaded, does its hash match? logger . info ( 'File was already downloaded %s' , download_path ) if link . hash : download_hash = _get_hash_from_file ( download_path , link ) try : _check_hash ( download_hash , link ) except HashMismatch : logger . warning ( 'Previously-downloaded file %s has bad hash, ' 're-downloading.' , download_path ) os . unlink ( download_path ) return None return download_path return None
Check download_dir for previously downloaded file with correct hash
        If a correct file is found return its path else None
Check download_dir for previously downloaded file with correct hash If a correct file is found return its path else None