SafeLockedFileForWrite

class lsst.daf.butler.core.safeFileIo.SafeLockedFileForWrite(name)

Bases: object

File-like object that is used to create a file if needed, lock it with an exclusive lock, and contain file descriptors to readable and writable versions of the file.

This will only open a file descriptor in “write” mode if a write operation is performed. If no write operation is performed, the existing file (if there is one) will not be overwritten.

Contains __enter__ and __exit__ functions so this can be used by a context manager.

Attributes Summary

readable
writeable

Methods Summary

close()
open()
read([size])
write(str)

Attributes Documentation

readable
writeable

Methods Documentation

close()
open()
read(size=None)
write(str)