lsst.daf.persistence  13.0-17-gd5d205a+2
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Functions
lsst.daf.persistence.safeFileIo Namespace Reference

Functions

def safeMakeDir
 
def setFileMode
 
def FileForWriteOnceCompareSame
 
def SafeFile
 
def SafeFilename
 

Function Documentation

def lsst.daf.persistence.safeFileIo.FileForWriteOnceCompareSame (   name)
Context manager to get a file that can be written only once and all other writes will succeed only if
they match the inital write.

The context manager provides a temporary file object. After the user is done, the temporary file becomes
the permanent file if the file at name does not already exist. If the file at name does exist the
temporary file is compared to the file at name. If they are the same then this is good and the temp file
is silently thrown away. If they are not the same then a runtime error is raised.

Definition at line 55 of file safeFileIo.py.

def lsst.daf.persistence.safeFileIo.SafeFile (   name)
Context manager to create a file in a manner avoiding race conditions

The context manager provides a temporary file object. After the user is done,
we move that file into the desired place and close the fd to avoid resource
leakage.

Definition at line 96 of file safeFileIo.py.

def lsst.daf.persistence.safeFileIo.SafeFilename (   name)
Context manager for creating a file in a manner avoiding race conditions

The context manager provides a temporary filename with no open file descriptors
(as this can cause trouble on some systems). After the user is done, we move the
file into the desired place.

Definition at line 114 of file safeFileIo.py.

def lsst.daf.persistence.safeFileIo.safeMakeDir (   directory)
Make a directory in a manner avoiding race conditions

Definition at line 33 of file safeFileIo.py.

def lsst.daf.persistence.safeFileIo.setFileMode (   filename)
Set a file mode according to the user's umask

Definition at line 44 of file safeFileIo.py.