armi.utils.directoryChangers module¶
-
class
armi.utils.directoryChangers.DirectoryChanger(destination, filesToMove=None, filesToRetrieve=None)[source]¶ Bases:
objectUtility class to change directory
Use with ‘with’ statements to execute code in a different dir, guaranteeing a clean return to the original directory
>>> with DirectoryChanger(r'C:\whatever') ... pass
Establish the new and return directories
-
__enter__()[source]¶ At the inception of a with command, navigate to a new directory if one is supplied.
-
__exit__(exc_type, exc_value, traceback)[source]¶ At the termination of a with command, navigate back to the original directory.
-
-
class
armi.utils.directoryChangers.TemporaryDirectoryChanger(root=None, filesToMove=None, filesToRetrieve=None)[source]¶ Bases:
armi.utils.directoryChangers.DirectoryChangerCreate temporary directory, changes into it, and if there is no error/exception generated when using a
withstatement, it deletes the directory.Notes
If there is an error/exception generated while in a
withstatement, the temporary directory contents will be copied to the original directory and then the temporary directory will be deleted.Establish the new and return directories
-
class
armi.utils.directoryChangers.ForcedCreationDirectoryChanger(destination, filesToMove=None, filesToRetrieve=None, clean=False)[source]¶ Bases:
armi.utils.directoryChangers.DirectoryChangerCreates the directory tree necessary to reach your desired destination
-
clean¶ if True and the directory exists, clear all contents on entry.
- Type
bool
Establish the new and return directories
-