#NEWLINE# def check( self , code , filename ) : #NEWLINE# #INDENT# 'Run pep8 on code and return the output.' #NEWLINE# options = { #NEWLINE# #INDENT# 'reporter' : self . get_report ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# type_map = { #NEWLINE# #INDENT# 'select' : [ ] , #NEWLINE# 'ignore' : [ ] , #NEWLINE# 'max-line-length' : 0 , #NEWLINE# 'max-complexity' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# self . build_options ( options , type_map , transform = ( lambda s : s . replace ( '-' , '_' ) ) ) #NEWLINE# final_options = options . copy ( ) #NEWLINE# try : #NEWLINE# #INDENT# def onError( msg ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# from pep8 import process_options , get_parser #NEWLINE# parser = get_parser ( ) #NEWLINE# parser . error = onError #NEWLINE# ( pep8_options , _ ) = process_options ( [ os . curdir ] , True , True , parser = parser ) #NEWLINE# if os . path . isfile ( pep8_options . config ) : #NEWLINE# #INDENT# pep8_options = vars ( pep8_options ) #NEWLINE# pep8_options . pop ( 'reporter' , None ) #NEWLINE# for ( opt_n , opt_v ) in pep8_options . items ( ) : #NEWLINE# #INDENT# if isinstance ( final_options . get ( opt_n , None ) , list ) : #NEWLINE# #INDENT# final_options [ opt_n ] += opt_v #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# final_options [ opt_n ] = opt_v #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except SystemExit : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if persist . debug_mode ( ) : #NEWLINE# #INDENT# persist . printf ( '{} ST options: {}' . format ( self . name , options ) ) #NEWLINE# persist . printf ( '{} options: {}' . format ( self . name , final_options ) ) #NEWLINE# #UNINDENT# checker = self . module . StyleGuide ( ** final_options ) #NEWLINE# return checker . input_file ( filename = os . path . basename ( options ) , lines = code . splitlines ( keepends = True ) )