def run_pep8_for_package(package_name, extra_ignore=None):
 import pep8
 class Checker(pep8.Checker, ):
  u"\n        Subclass pep8's Checker to hook into error reporting.\n        "
  def __init__(self, *args, **kwargs):
   super(Checker, self).__init__(*args, **kwargs)
   self.report_error = self._report_error
  def _report_error(self, line_number, offset, text, check):
   u'\n            Store pairs of line numbers and errors.\n            '
   self.errors.append((line_number, text.split(u' ', 1)[1]))
  def check_all(self, *args, **kwargs):
   u'\n            Assign the errors attribute and return it after running.\n            '
   self.errors = []
   super(Checker, self).check_all(*args, **kwargs)
   return self.errors
 def pep8_checker(path):
  for (line_number, text) in Checker(path).check_all():
   (yield (u'%s:%s: %s' % (path, line_number, text)))
 args = (pep8_checker, package_name, extra_ignore)
 return _run_checker_for_package(*args)

def run_pep8_for_package ( package_name , extra_ignore = None ) : import pep8 class Checker ( pep8 . Checker , ) : def __init__ ( self , * args , ** kwargs ) : super ( Checker , self ) . __init__ ( * args , ** kwargs ) self . report_error = self . _report_error def _report_error ( self , line_number , offset , text , check ) : self . errors . append ( ( line_number , text . split ( u' ' , 1 ) [ 1 ] ) ) def check_all ( self , * args , ** kwargs ) : self . errors = [ ] super ( Checker , self ) . check_all ( * args , ** kwargs ) return self . errors def pep8_checker ( path ) : for ( line_number , text ) in Checker ( path ) . check_all ( ) : ( yield ( u'%s:%s: %s' % ( path , line_number , text ) ) ) args = ( pep8_checker , package_name , extra_ignore ) return _run_checker_for_package ( * args )
if pep8 is installed .