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