def process_file_metrics(context, file_processors):
file_metrics = OrderedDict()<EOL>gitignore = []<EOL>if os.path.isfile('<STR_LIT>'):<EOL><INDENT>with open('<STR_LIT>', '<STR_LIT:r>') as ifile:<EOL><INDENT>gitignore = ifile.read().splitlines()<EOL><DEDENT><DEDENT>in_files = glob_files(context['<STR_LIT>'], context['<STR_LIT>'], gitignore=gitignore)<EOL>for in_file, key in in_files:<EOL><INDENT>try:<EOL><INDENT>with open(in_file, '<STR_LIT:rb>') as ifile:<EOL><INDENT>code = ifile.read()<EOL><DEDENT>try:<EOL><INDENT>lex = guess_lexer_for_filename(in_file, code, encoding='<STR_LIT>')<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>token_list = lex.get_tokens(code)  <EOL>file_metrics[key] = OrderedDict()<EOL>file_metrics[key].update(compute_file_metrics(file_processors, lex.name, key, token_list))<EOL>file_metrics[key]['<STR_LIT>'] = lex.name<EOL><DEDENT><DEDENT>except IOError as e:<EOL><INDENT>sys.stderr.writelines(str(e) + "<STR_LIT>")<EOL><DEDENT><DEDENT>return file_metrics<EOL>
Main routine for metrics.