22 __all__ = (
"FitsGenericFormatter", )
 
   26 from lsst.daf.butler.formatters.fileFormatter 
import FileFormatter
 
   30     """Interface for reading and writing objects that support the standard 
   31     afw I/O readFits/writeFits methods. 
   35     def _readFile(self, path, pytype):
 
   36         """Read a file from the path in FITS format. 
   41             Path to use to open the file. 
   43             Class to use to read the FITS file. 
   48             Instance of class `pytype` read from FITS file. None 
   49             if the file could not be opened. 
   51         if not os.path.exists(path):
 
   54         return pytype.readFits(path)
 
   56     def _writeFile(self, inMemoryDataset):
 
   57         """Write the in memory dataset to file on disk. 
   61         inMemoryDataset : `object` 
   67             The file could not be written. 
   69         inMemoryDataset.writeFits(self.fileDescriptor.location.path)