Cheetah.FileUtils module¶
- class Cheetah.FileUtils.FileFinder(rootPath, globPatterns=('*',), ignoreBasenames=('CVS', '.svn'), ignoreDirs=())¶
- Bases: - object- Traverses a directory tree and finds all files in it that match one of the specified glob patterns. - files()¶
 - filterDir(baseName, fullPath)¶
- A hook for filtering out certain dirs. 
 - processDir(dir, glob=<function glob>)¶
 - walkDirTree(dir='.', listdir=<built-in function listdir>, isdir=<function isdir>, join=<function join>)¶
- Recursively walk through a directory tree and find matching files 
 
- class Cheetah.FileUtils.FindAndReplace(files, patternOrRE, replacement, recordResults=True)¶
- Bases: - object- Find and replace all instances of ‘patternOrRE’ with ‘replacement’ for each file in the ‘files’ list. This is a multi-file version of re.sub(). - ‘patternOrRE’ can be a raw regex pattern or a regex object as generated by the re module. ‘replacement’ can be any string that would work with patternOrRE.sub(replacement, fileContents). - results()¶
 
- class Cheetah.FileUtils.SourceFileStats(files)¶
- Bases: - object- getFileStats(fileName)¶
 - printStats()¶
 - rawStats()¶
 - summary()¶
 
- Cheetah.FileUtils.findFiles(*args, **kw)¶
- Recursively find all the files matching a glob pattern. - This function is a wrapper around the FileFinder class. See its docstring for details about the accepted arguments, etc. 
- Cheetah.FileUtils.replaceRegexInFiles(files, pattern, repl)¶
- Replace all instances of regex ‘pattern’ with ‘repl’ for each file in the ‘files’ list. Returns a dictionary with data about the matches found. - This is like re.sub on a multi-file basis. - This function is a wrapper around the FindAndReplace class. See its docstring for more details. 
- Cheetah.FileUtils.replaceStrInFiles(files, theStr, repl)¶
- Replace all instances of ‘theStr’ with ‘repl’ for each file in the ‘files’ list. Returns a dictionary with data about the matches found. - This is like string.replace() on a multi-file basis. - This function is a wrapper around the FindAndReplace class. See its docstring for more details.