parameters: (filenames, recursive, exclude)
return_statement: return python_files
docstring: Find all Python files.
docstring_summary: Find all Python files.
docstring_tokens: Find all Python files .
function: def _FindPythonFiles(filenames, recursive, exclude):
    """Find all Python files."""
    python_files = []
    for filename in filenames:
      if os.path.isdir(filename):
        if recursive:
          # TODO(morbo): Look into a version of os.walk that can handle recursion.
          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
function_tokens: def _FindPythonFiles ( filenames , recursive , exclude ) : python_files = [ ] for filename in filenames : if os . path . isdir ( filename ) : if recursive : # TODO(morbo): Look into a version of os.walk that can handle recursion. 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