home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_262 / dircache.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2011-09-09  |  1.1 KB  |  44 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.7)
  3.  
  4. from warnings import warnpy3k
  5. warnpy3k('the dircache module has been removed in Python 3.0', stacklevel = 2)
  6. del warnpy3k
  7. import os
  8. __all__ = [
  9.     'listdir',
  10.     'opendir',
  11.     'annotate',
  12.     'reset']
  13. cache = { }
  14.  
  15. def reset():
  16.     global cache
  17.     cache = { }
  18.  
  19.  
  20. def listdir(path):
  21.     
  22.     try:
  23.         (cached_mtime, list) = cache[path]
  24.         del cache[path]
  25.     except KeyError:
  26.         cached_mtime = -1
  27.         list = []
  28.  
  29.     mtime = os.stat(path).st_mtime
  30.     if mtime != cached_mtime:
  31.         list = os.listdir(path)
  32.         list.sort()
  33.     cache[path] = (mtime, list)
  34.     return list
  35.  
  36. opendir = listdir
  37.  
  38. def annotate(head, list):
  39.     for i in range(len(list)):
  40.         if os.path.isdir(os.path.join(head, list[i])):
  41.             list[i] = list[i] + '/'
  42.             continue
  43.  
  44.