def parse_req_file(req_file, verbatim=False):
req_list = []<EOL>requirements = req_file.readlines()<EOL>for requirement in requirements:<EOL><INDENT>requirement_no_comments = requirement.split('<STR_LIT:#>')[<NUM_LIT:0>].strip()<EOL>req_match = re.match(<EOL>r'<STR_LIT>',<EOL>requirement_no_comments<EOL>)<EOL>req_ignore = requirement.strip().endswith('<STR_LIT>')<EOL>if req_match:<EOL><INDENT>req_list.append((req_match.group('<STR_LIT>'),<EOL>req_match.group('<STR_LIT:version>'),<EOL>req_ignore))<EOL><DEDENT>elif requirement_no_comments.startswith('<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>base_dir = os.path.dirname(os.path.abspath(req_file.name))<EOL><DEDENT>except AttributeError:<EOL><INDENT>print(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>)<EOL>continue<EOL><DEDENT>file_name = requirement_no_comments.replace('<STR_LIT>', '<STR_LIT>').strip()<EOL>new_path = os.path.join(base_dir, file_name)<EOL>try:<EOL><INDENT>if verbatim:<EOL><INDENT>req_list.append((None, requirement, req_ignore))<EOL><DEDENT>req_list.extend(<EOL>parse_req_file(<EOL>open(new_path),<EOL>verbatim=verbatim<EOL>)<EOL>)<EOL><DEDENT>except IOError:<EOL><INDENT>print('<STR_LIT>'.format(file_name))<EOL><DEDENT><DEDENT>elif verbatim:<EOL><INDENT>req_list.append((None, requirement, req_ignore))<EOL><DEDENT><DEDENT>return req_list<EOL>
Take a file and return a dict of (requirement, versions, ignore) based
    on the files requirements specs.