<s> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> import argparse <EOL> from pre_commit_hooks . util import added_files <EOL> from pre_commit_hooks . util import cmd_output <EOL> def lower_set ( iterable ) : <EOL> return set ( x . lower ( ) for x in iterable ) <EOL> def find_conflicting_filenames ( filenames ) : <EOL> repo_files = set ( cmd_output ( '<STR_LIT>' , '<STR_LIT>' ) . splitlines ( ) ) <EOL> relevant_files = set ( filenames ) | added_files ( ) <EOL> repo_files -= relevant_files <EOL> retv = <NUM_LIT:0> <EOL> conflicts = lower_set ( repo_files ) & lower_set ( relevant_files ) <EOL> lowercase_relevant_files = lower_set ( relevant_files ) <EOL> for filename in set ( relevant_files ) : <EOL> if filename . lower ( ) in lowercase_relevant_files : <EOL> lowercase_relevant_files . remove ( filename . lower ( ) ) <EOL> else : <EOL> conflicts . add ( filename . lower ( ) ) <EOL> if conflicts : <EOL> conflicting_files = [ <EOL> x for x in repo_files | relevant_files <EOL> if x . lower ( ) in conflicts <EOL> ] <EOL> for filename in sorted ( conflicting_files ) : <EOL> print ( '<STR_LIT>' . format ( filename ) ) <EOL> retv = <NUM_LIT:1> <EOL> return retv <EOL> def main ( argv = None ) : <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( <EOL> '<STR_LIT>' , nargs = '<STR_LIT:*>' , <EOL> help = '<STR_LIT>' <EOL> ) <EOL> args = parser . parse_args ( argv ) <EOL> return find_conflicting_filenames ( args . filenames ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> exit ( main ( ) ) </s>
