parameters: (path)
return_statement: return list
docstring: List directory contents, using cache.
docstring_summary: List directory contents, using cache.
docstring_tokens: List directory contents using cache .
function: def listdir(path):
      """List directory contents, using cache."""
      try:
          cached_mtime, list = cache[path]
          del cache[path]
      except KeyError:
          cached_mtime, list = -1, []
      mtime = os.stat(path).st_mtime
      if mtime != cached_mtime:
          list = os.listdir(path)
          list.sort()
      cache[path] = mtime, list
      return list
function_tokens: def listdir ( path ) : try : cached_mtime , list = cache [ path ] del cache [ path ] except KeyError : cached_mtime , list = - 1 , [ ] mtime = os . stat ( path ) . st_mtime if mtime != cached_mtime : list = os . listdir ( path ) list . sort ( ) cache [ path ] = mtime , list return list