Changeset ff99eae in flex_extract.git for python/UioFiles.py
- Timestamp:
- Jun 1, 2018, 8:34:59 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- e1228f3
- Parents:
- ccab809
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
python/UioFiles.py
r991df6a rff99eae 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 #************************************************************************4 # TODO AP5 # - checken welche regelmässigen methoden auf diese Files noch angewendet werden6 # und dann hier implementieren7 # cleanup hier rein8 #************************************************************************9 3 #******************************************************************************* 10 4 # @Author: Anne Fouilloux (University of Oslo) … … 15 9 # 16 10 # November 2015 - Leopold Haimberger (University of Vienna): 17 # - modified method list Files to work with glob instead of listdir18 # - added pattern search in method list Files11 # - modified method list_files to work with glob instead of listdir 12 # - added pattern search in method list_files 19 13 # 20 14 # February 2018 - Anne Philipp (University of Vienna): 21 15 # - applied PEP8 style guide 22 16 # - added documentation 23 # - optimisation of method list Files since it didn't work correctly17 # - optimisation of method list_files since it didn't work correctly 24 18 # for sub directories 25 # - additional speed up of method list Files19 # - additional speed up of method list_files 26 20 # - modified the class so that it is initiated with a pattern instead 27 21 # of suffixes. Gives more precision in selection of files. … … 40 34 # @Class Content: 41 35 # - __init__ 42 # - listFiles 43 # - deleteFiles 36 # - list_files 37 # - delete_files 38 # 39 # @Class Attributes: 40 # - pattern 41 # - files 44 42 # 45 43 #******************************************************************************* … … 49 47 # ------------------------------------------------------------------------------ 50 48 import os 51 import glob52 49 import fnmatch 53 import time54 50 55 51 # software specific module from flex_extract 56 import profiling57 from Tools import silentremove52 #import profiling 53 from tools import silent_remove 58 54 59 55 # ------------------------------------------------------------------------------ … … 61 57 # ------------------------------------------------------------------------------ 62 58 63 class U IOFiles:59 class UioFiles(object): 64 60 ''' 65 61 Class to manipulate files. At initialisation it has the attribute … … 76 72 77 73 @Input: 78 self: instance of U IOFiles74 self: instance of UioFiles 79 75 Description see class documentation. 80 76 … … 87 83 88 84 self.pattern = pattern 85 self.files = None 89 86 90 87 return 91 88 92 89 #@profiling.timefn 93 def list Files(self, path, callid=0):90 def list_files(self, path, callid=0): 94 91 ''' 95 92 @Description: … … 98 95 99 96 @Input: 100 self: instance of U IOFiles97 self: instance of UioFiles 101 98 Description see class documentation. 102 99 … … 132 129 if subdirs: 133 130 for subdir in subdirs: 134 self.list Files(os.path.join(path, subdir), callid=1)131 self.list_files(os.path.join(path, subdir), callid=1) 135 132 136 133 return 137 134 138 def delete Files(self):135 def delete_files(self): 139 136 ''' 140 137 @Description: … … 142 139 143 140 @Input: 144 self: instance of U IOFiles141 self: instance of UioFiles 145 142 Description see class documentation. 146 143 … … 149 146 ''' 150 147 151 for fin self.files:152 silent remove(f)148 for old_file in self.files: 149 silent_remove(old_file) 153 150 154 151 return
Note: See TracChangeset
for help on using the changeset viewer.