Ignore:
Timestamp:
07.09.2010 21:50:47 (21 months ago)
Author:
zmsdev
Message:

Revised comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ZMS/trunk/_fileutil.py

    r1140 r1143  
    5959 
    6060 
    61 # ------------------------------------------------------------------------------ 
    62 _fileutil.importZexp: 
    63 # 
    64 Import file from specified path. 
    65 # ------------------------------------------------------------------------------ 
     61""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     62_fileutil.importZexp: 
     63 
     64Import file from specified path. 
     65""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    6666def importZexp(self, filename): 
    6767  filepath = INSTANCE_HOME + '/import/' + filename 
     
    7070 
    7171 
    72 # ------------------------------------------------------------------------------ 
    73 _fileutil.extractFilename: 
    74 # 
    75 Extract filename from path. 
    76 IN:  path 
    77 # ------------------------------------------------------------------------------ 
     72""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     73_fileutil.extractFilename: 
     74 
     75Extract filename from path. 
     76IN:  path 
     77""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    7878def extractFilename(path, sep=None): 
    7979  if sep is None: 
     
    8484 
    8585 
    86 # ------------------------------------------------------------------------------ 
    87 _fileutil.extractFileExt: 
    88 #  
    89 Extract fileextension from path. 
    90 IN:  path 
    91 OUT: extension 
    92 # ------------------------------------------------------------------------------ 
     86""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     87_fileutil.extractFileExt: 
     88 
     89Extract fileextension from path. 
     90IN:  path 
     91OUT: extension 
     92""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    9393def extractFileExt(path): 
    9494  items = path.split('.') 
     
    9797 
    9898 
    99 # ------------------------------------------------------------------------------ 
    100 _fileutil.getOSPath: 
    101 #  
    102 Return path with OS separators. 
    103 # ------------------------------------------------------------------------------ 
     99""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     100_fileutil.getOSPath: 
     101 
     102Return path with OS separators. 
     103""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    104104def getOSPath(path, sep=None, chs=range(32)+[34,60,62,63,127]): 
    105105  if sep is None: sep = os.sep 
     
    115115 
    116116 
    117 # ------------------------------------------------------------------------------ 
    118 _fileutil.getFilePath: 
    119 # 
    120 Extract filepath from path (cut-off filename). 
    121 IN:  path 
    122 OUT: filepath 
    123 # ------------------------------------------------------------------------------ 
     117""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     118_fileutil.getFilePath: 
     119 
     120Extract filepath from path (cut-off filename). 
     121IN:  path 
     122OUT: filepath 
     123""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    124124def getFilePath(path): 
    125125  items = getOSPath(path).split(os.sep) 
     
    133133 
    134134 
    135 # ------------------------------------------------------------------------------ 
    136 # _fileutil.findExtension: 
    137 # 
    138 Searches path and all subdirectories for file with extension and returns  
    139 complete filepath. Returns None if no file with specified extension exists. 
    140 IN:  extension 
    141      path 
    142 OUT: filepath 
    143 # ------------------------------------------------------------------------------ 
     135""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     136 _fileutil.findExtension: 
     137 
     138Searches path and all subdirectories for file with extension and returns  
     139complete filepath. Returns None if no file with specified extension exists. 
     140IN:  extension 
     141     path 
     142OUT: filepath 
     143""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    144144def findExtension(extension, path, deep=1): 
    145145  rtn = None 
     
    158158 
    159159 
    160 # ------------------------------------------------------------------------------ 
    161 _fileutil.readPath: 
    162 # 
    163 Reads path. 
    164 # ------------------------------------------------------------------------------ 
     160""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     161_fileutil.readPath: 
     162 
     163Reads path. 
     164""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    165165def readPath(path, data=True, recursive=True): 
    166166  l = [] 
     
    213213 
    214214 
    215 # ------------------------------------------------------------------------------ 
    216 _fileutil.readFile: 
    217 # 
    218 Reads file (threshold for filesteam_iterator is 128 kb). 
    219 # ------------------------------------------------------------------------------ 
     215""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     216_fileutil.readFile: 
     217 
     218Reads file (threshold for filesteam_iterator is 128 kb). 
     219""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    220220def readFile(filename, mode='b', threshold=2 << 16): 
    221221  size = os.path.getsize( filename) 
     
    237237 
    238238 
    239 # ------------------------------------------------------------------------------ 
    240 _fileutil.importPath: 
    241 # 
    242 Imports path. 
    243 # ------------------------------------------------------------------------------ 
     239""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     240_fileutil.importPath: 
     241 
     242Imports path. 
     243""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    244244def importPath(self, path): 
    245245  path = getOSPath(path) 
     
    259259 
    260260 
    261 # ------------------------------------------------------------------------------ 
    262 _fileutil.remove: 
    263 # 
    264 Removes path (and all its subdirectories if deep==1). 
    265 # ------------------------------------------------------------------------------ 
     261""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     262_fileutil.remove: 
     263 
     264Removes path (and all its subdirectories if deep==1). 
     265""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    266266def remove(path, deep=0): 
    267267  path = getOSPath(path) 
     
    281281 
    282282 
    283 # ------------------------------------------------------------------------------ 
    284 _fileutil.getDataSizeStr:  
    285 # 
    286 Display string for file-size. 
    287 # ------------------------------------------------------------------------------ 
     283""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     284_fileutil.getDataSizeStr:  
     285 
     286Display string for file-size. 
     287""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    288288def getDataSizeStr(len): 
    289289  s = '' 
     
    308308 
    309309 
    310 # ------------------------------------------------------------------------------ 
    311 _fileutil.executeCommand: 
    312 # ------------------------------------------------------------------------------ 
     310""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     311_fileutil.executeCommand: 
     312""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    313313def executeCommand(path, command): 
    314314  os.chdir(path) 
    315315  os.system(command) 
    316316 
    317      
    318 # ------------------------------------------------------------------------------ 
    319 _fileutil.exportObj: 
    320 # ------------------------------------------------------------------------------ 
     317 
     318""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     319_fileutil.exportObj: 
     320""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    321321def exportObj(obj, filename, filetype='b'): 
    322      
     322   
    323323  #-- Try to create directory-tree. 
    324324  filename = getOSPath(filename) 
     
    358358 
    359359 
    360 # ------------------------------------------------------------------------------ 
    361 _fileutil.mkDir: 
    362 # 
    363 Make directory. 
    364 # ------------------------------------------------------------------------------ 
     360""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     361_fileutil.mkDir: 
     362 
     363Make directory. 
     364""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    365365def mkDir(path): 
    366366  try: 
     
    370370 
    371371 
    372 # ------------------------------------------------------------------------------ 
    373 _fileutil.readDir 
    374 # ------------------------------------------------------------------------------ 
     372""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     373_fileutil.readDir 
     374""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    375375def readDir(path): 
    376376  obs = [] 
     
    399399################################################################################ 
    400400 
    401 # ------------------------------------------------------------------------------ 
    402 _fileutil.getZipArchive: 
    403 # 
    404 Extract files from zip-archive and return list of extracted files. 
    405 # ------------------------------------------------------------------------------ 
     401""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     402_fileutil.getZipArchive: 
     403 
     404Extract files from zip-archive and return list of extracted files. 
     405""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    406406def getZipArchive(f): 
    407407  l = [] 
     
    428428 
    429429 
    430 # ------------------------------------------------------------------------------ 
    431 _fileutil.extractZipArchive: 
    432 # 
    433 Unpack ZIP-Archive. 
    434 # ------------------------------------------------------------------------------ 
     430""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     431_fileutil.extractZipArchive: 
     432 
     433Unpack ZIP-Archive. 
     434""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    435435def extractZipArchive(file): 
    436436  l = [] 
     
    455455 
    456456 
    457 # ------------------------------------------------------------------------------ 
    458 #  _fileutil.buildZipArchive: 
    459 # 
    460 #  Pack ZIP-Archive and return data. 
    461 # ------------------------------------------------------------------------------ 
     457""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     458_fileutil.writeZipFile: 
     459""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    462460def writeZipFile( zf, basepath, path, filter): 
    463461  for file in os.listdir( path): 
     
    474472        zf.write( filepath, arcname) 
    475473 
     474""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
     475_fileutil.buildZipArchive: 
     476 
     477Pack ZIP-Archive and return data. 
     478""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" 
    476479def buildZipArchive( files, get_data=True): 
    477480   
Note: See TracChangeset for help on using the changeset viewer.