def parse_requirements(filename):
reqs = []<EOL>version_spec_in_play = None<EOL>for line in open(filename, '<STR_LIT:r>').read().strip().split('<STR_LIT:\n>'):<EOL><INDENT>if not line.strip():<EOL><INDENT>continue<EOL><DEDENT>if not line.startswith('<STR_LIT:#>'):<EOL><INDENT>reqs.append(line)<EOL>continue<EOL><DEDENT>match = re.search(r'<STR_LIT>'<EOL>r'<STR_LIT>', line)<EOL>if match:<EOL><INDENT>version_spec_in_play = match.groupdict()<EOL>for key in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>version_spec_in_play[key] = int(version_spec_in_play[key])<EOL><DEDENT>continue<EOL><DEDENT>if '<STR_LIT:U+0020>' not in line[<NUM_LIT:1>:].strip() and version_spec_in_play:<EOL><INDENT>package = line[<NUM_LIT:1>:].strip()<EOL>op = version_spec_in_play['<STR_LIT>']<EOL>vspec = (version_spec_in_play['<STR_LIT>'],<EOL>version_spec_in_play['<STR_LIT>'])<EOL>if '<STR_LIT:=>' in op and sys.version_info[<NUM_LIT:0>:<NUM_LIT:2>] == vspec:<EOL><INDENT>reqs.append(package)<EOL><DEDENT>elif '<STR_LIT:>>' in op and sys.version_info[<NUM_LIT:0>:<NUM_LIT:2>] > vspec:<EOL><INDENT>reqs.append(package)<EOL><DEDENT>elif '<STR_LIT:<>' in op and sys.version_info[<NUM_LIT:0>:<NUM_LIT:2>] < vspec:<EOL><INDENT>reqs.append(package)<EOL><DEDENT><DEDENT><DEDENT>return reqs<EOL>
Parse out a list of requirements from the given requirements
    requirements file.