Package PyFoam :: Package Basics :: Module Utilities :: Class Utilities
[hide private]
[frames] | no frames]

Class Utilities

source code


Class with utility methods

Can be inherited without side effects by classes that need these methods

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
copyfile(self, src, dst)
Encapsulates the shutil copyfile and provides an alternative for old Python-version
source code
 
copytree(self, src, dst, symlinks=False)
Encapsulates the shutil copytree and provides an alternative for old Python-version
source code
 
execute(self, cmd, debug=False)
Execute the command cmd
source code
 
find(self, pattern, path, directoriesToo=True)
Find all files whose names match
source code
 
listDirectory(self, d)
Lists the files in a directory, but excludes certain names and files with certain endings
source code
 
remove(self, f)
Remove a file if it exists.
source code
 
rmtree(self, path, ignore_errors=False)
Encapsulates the shutil rmtree and provides an alternative for old Python-version
source code
 
which(self, progname)
Get the full path.
source code
 
writeDictionaryHeader(self, f)
Writes a dummy header so OpenFOAM accepts the file as a dictionary
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  excludeNames = ['^.svn$', '~$']
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

execute(self, cmd, debug=False)

source code 

Execute the command cmd

Currently no error-handling is done

Returns:
A list with all the output-lines of the execution

find(self, pattern, path, directoriesToo=True)

source code 

Find all files whose names match

Parameters:
  • pattern - glob-style pattern
  • path - path under which this files are to be searched
  • directoriesToo - also match directories?

listDirectory(self, d)

source code 

Lists the files in a directory, but excludes certain names and files with certain endings

Parameters:
  • d - The directory to list
Returns:
List of the found files and directories

which(self, progname)

source code 

Get the full path. Return None if not found

writeDictionaryHeader(self, f)

source code 

Writes a dummy header so OpenFOAM accepts the file as a dictionary

Parameters:
  • f (file) - The file to write to