FileForWriteOnceCompareSame

lsst.daf.butler.core.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 initial 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.