def _FindPythonFiles(filenames, recursive, exclude):
 python_files = []
 for filename in filenames:
  if os.path.isdir(filename):
   if recursive:
    python_files.extend((os.path.join(dirpath, f) for (dirpath, _, filelist) in os.walk(filename) for f in filelist if IsPythonFile(os.path.join(dirpath, f))))
   else:
    raise errors.YapfError(("directory specified without '--recursive' flag: %s" % filename))
  elif os.path.isfile(filename):
   python_files.append(filename)
 if exclude:
  return [f for f in python_files if (not any((fnmatch.fnmatch(f, p) for p in exclude)))]
 return python_files

def _FindPythonFiles ( filenames , recursive , exclude ) : python_files = [ ] for filename in filenames : if os . path . isdir ( filename ) : if recursive : python_files . extend ( ( os . path . join ( dirpath , f ) for ( dirpath , _ , filelist ) in os . walk ( filename ) for f in filelist if IsPythonFile ( os . path . join ( dirpath , f ) ) ) ) else : raise errors . YapfError ( ( "directory specified without '--recursive' flag: %s" % filename ) ) elif os . path . isfile ( filename ) : python_files . append ( filename ) if exclude : return [ f for f in python_files if ( not any ( ( fnmatch . fnmatch ( f , p ) for p in exclude ) ) ) ] return python_files
find all python files .