<s> """<STR_LIT>""" <EOL> from __future__ import print_function , absolute_import <EOL> import sys <EOL> import click <EOL> import git <EOL> import turnstile . checks as checks <EOL> import turnstile . common . config as config <EOL> import turnstile . common . output as output <EOL> import turnstile . models . staging as staging <EOL> @ click . command ( ) <EOL> def pre_commit ( ) : <EOL> """<STR_LIT>""" <EOL> repository = git . Repo ( ) <EOL> user_configuration = config . UserConfiguration ( ) <EOL> logger = output . get_root_logger ( '<STR_LIT>' ) <EOL> logger . setLevel ( user_configuration . verbosity ) <EOL> logger . debug ( '<STR_LIT>' ) <EOL> logger . debug ( '<STR_LIT>' , repository . working_dir ) <EOL> try : <EOL> repository_configuration = config . load_repository_configuration ( repository . working_dir ) <EOL> except ValueError as e : <EOL> logger . error ( e ) <EOL> raise click . Abort <EOL> logger . debug ( '<STR_LIT>' , repository_configuration [ '<STR_LIT>' ] ) <EOL> staging_area = staging . StagingArea ( repository ) <EOL> logger . debug ( '<STR_LIT>' , len ( staging_area . changes ) ) <EOL> failed_checks = checks . run_checks ( '<STR_LIT>' , user_configuration , repository_configuration , staging_area ) <EOL> if failed_checks : <EOL> s = '<STR_LIT>' if failed_checks == <NUM_LIT:1> else '<STR_LIT:s>' <EOL> logger . error ( '<STR_LIT>' , failed_checks , s ) <EOL> sys . exit ( failed_checks ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> pre_commit ( ) </s>
