def read_requirements_file(path):
    """
    reads requirements.txt file and handles PyPI index URLs
    :param path: (str) path to requirements.txt file
    :return: (tuple of lists)
    """
    last_pypi_url = None
    with open(path) as f:
        requires = []
        pypi_urls = []
        for line in f.readlines():
            if not line:
                continue
            if '--' in line:
                match = re.match(r'--index-url\s+([\w\d:/.-]+)\s', line)
                if match:
                    last_pypi_url = match.group(1)
                    if not last_pypi_url.endswith("/"):
                        last_pypi_url += "/"
            else:
                if last_pypi_url:
                    pypi_urls.append(last_pypi_url + line.strip().lower())
                requires.append(line)
    return requires, pypi_urls
def read_requirements_file ( path ) : last_pypi_url = None with open ( path ) as f : requires = [ ] pypi_urls = [ ] for line in f . readlines ( ) : if not line : continue if '--' in line : match = re . match ( r'--index-url\s+([\w\d:/.-]+)\s' , line ) if match : last_pypi_url = match . group ( 1 ) if not last_pypi_url . endswith ( "/" ) : last_pypi_url += "/" else : if last_pypi_url : pypi_urls . append ( last_pypi_url + line . strip ( ) . lower ( ) ) requires . append ( line ) return requires , pypi_urls
reads requirements.txt file and handles PyPI index URLs
    :param path: (str) path to requirements.txt file
    :return: (tuple of lists)