parameters: (dir = os.curdir)
return_statement: return list
docstring: Find all files under 'dir' and return the list of full filenames
      (relative to 'dir').
docstring_summary: Find all files under 'dir' and return the list of full filenames
      (relative to 'dir').
docstring_tokens: Find all files under dir and return the list of full filenames ( relative to dir ) .
function: def findall(dir = os.curdir):
      """Find all files under 'dir' and return the list of full filenames
      (relative to 'dir').
      """
      from stat import ST_MODE, S_ISREG, S_ISDIR, S_ISLNK
  
      list = []
      stack = [dir]
      pop = stack.pop
      push = stack.append
  
      while stack:
          dir = pop()
          names = os.listdir(dir)
  
          for name in names:
              if dir != os.curdir:        # avoid the dreaded "./" syndrome
                  fullname = os.path.join(dir, name)
              else:
                  fullname = name
  
              # Avoid excess stat calls -- just one will do, thank you!
              stat = os.stat(fullname)
              mode = stat[ST_MODE]
              if S_ISREG(mode):
                  list.append(fullname)
              elif S_ISDIR(mode) and not S_ISLNK(mode):
                  push(fullname)
  
      return list
function_tokens: def findall ( dir = os . curdir ) : from stat import ST_MODE , S_ISREG , S_ISDIR , S_ISLNK list = [ ] stack = [ dir ] pop = stack . pop push = stack . append while stack : dir = pop ( ) names = os . listdir ( dir ) for name in names : if dir != os . curdir : # avoid the dreaded "./" syndrome fullname = os . path . join ( dir , name ) else : fullname = name # Avoid excess stat calls -- just one will do, thank you! stat = os . stat ( fullname ) mode = stat [ ST_MODE ] if S_ISREG ( mode ) : list . append ( fullname ) elif S_ISDIR ( mode ) and not S_ISLNK ( mode ) : push ( fullname ) return list