def run_pyflakes_for_package(package_name, extra_ignore=None):
 from pyflakes.checker import Checker
 def pyflakes_checker(path):
  with open(path, u'U') as source_file:
   source = source_file.read()
  try:
   tree = compile(source, path, u'exec', PyCF_ONLY_AST)
  except (SyntaxError, IndentationError) as value:
   info = (path, value.lineno, value.args[0])
   (yield (u'Invalid syntax in %s:%d: %s' % info))
  else:
   result = Checker(tree, path)
   for warning in result.messages:
    (yield str(warning))
 args = (pyflakes_checker, package_name, extra_ignore)
 return _run_checker_for_package(*args)

def run_pyflakes_for_package ( package_name , extra_ignore = None ) : from pyflakes . checker import Checker def pyflakes_checker ( path ) : with open ( path , u'U' ) as source_file : source = source_file . read ( ) try : tree = compile ( source , path , u'exec' , PyCF_ONLY_AST ) except ( SyntaxError , IndentationError ) as value : info = ( path , value . lineno , value . args [ 0 ] ) ( yield ( u'Invalid syntax in %s:%d: %s' % info ) ) else : result = Checker ( tree , path ) for warning in result . messages : ( yield str ( warning ) ) args = ( pyflakes_checker , package_name , extra_ignore ) return _run_checker_for_package ( * args )
if pyflakes is installed .