def _parse_requires(path):
python_version = '<STR_LIT:.>'.join(map(str_cls, sys.version_info[<NUM_LIT:0>:<NUM_LIT:2>]))<EOL>sys_platform = sys.platform<EOL>packages = []<EOL>with open(path, '<STR_LIT:rb>') as f:<EOL><INDENT>contents = f.read().decode('<STR_LIT:utf-8>')<EOL><DEDENT>for line in re.split(r'<STR_LIT>', contents):<EOL><INDENT>line = line.strip()<EOL>if not len(line):<EOL><INDENT>continue<EOL><DEDENT>if re.match(r'<STR_LIT>', line):<EOL><INDENT>continue<EOL><DEDENT>if '<STR_LIT:;>' in line:<EOL><INDENT>package, cond = line.split('<STR_LIT:;>', <NUM_LIT:1>)<EOL>package = package.strip()<EOL>cond = cond.strip()<EOL>cond = cond.replace('<STR_LIT>', repr(sys_platform))<EOL>cond = cond.replace('<STR_LIT>', repr(python_version))<EOL>if not eval(cond):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>else:<EOL><INDENT>package = line.strip()<EOL><DEDENT>if re.match(r'<STR_LIT>', package):<EOL><INDENT>sub_req_file = re.sub(r'<STR_LIT>', '<STR_LIT>', package)<EOL>sub_req_file = os.path.abspath(os.path.join(os.path.dirname(path), sub_req_file))<EOL>packages.extend(_parse_requires(sub_req_file))<EOL>continue<EOL><DEDENT>if re.match(r'<STR_LIT>', package):<EOL><INDENT>packages.append({'<STR_LIT:type>': '<STR_LIT:url>', '<STR_LIT>': package})<EOL>continue<EOL><DEDENT>if '<STR_LIT>' in package:<EOL><INDENT>parts = package.split('<STR_LIT>')<EOL>package = parts[<NUM_LIT:0>].strip()<EOL>ver = parts[<NUM_LIT:1>].strip()<EOL>packages.append({'<STR_LIT:type>': '<STR_LIT>', '<STR_LIT>': package, '<STR_LIT>': ver})<EOL>continue<EOL><DEDENT>if '<STR_LIT>' in package:<EOL><INDENT>parts = package.split('<STR_LIT>')<EOL>package = parts[<NUM_LIT:0>].strip()<EOL>ver = parts[<NUM_LIT:1>].strip()<EOL>packages.append({'<STR_LIT:type>': '<STR_LIT>', '<STR_LIT>': package, '<STR_LIT>': ver})<EOL>continue<EOL><DEDENT>if re.search(r'<STR_LIT>', package):<EOL><INDENT>raise Exception('<STR_LIT>' % package)<EOL><DEDENT>packages.append({'<STR_LIT:type>': '<STR_LIT>', '<STR_LIT>': package})<EOL><DEDENT>return packages<EOL>
Does basic parsing of pip requirements files, to allow for
using something other than Python to do actual TLS requests

:param path:
    A path to a requirements file

:return:
    A list of dict objects containing the keys:
     - 'type' ('any', 'url', '==', '>=')
     - 'pkg'
     - 'ver' (if 'type' == '==' or 'type' == '>=')