def verify_checksums(filename):
 errors = 0
 try:
  hdulist = fits.open(filename, checksum=OPTIONS.checksum_kind)
 except UserWarning as w:
  remainder = ('.. ' + ' '.join(str(w).split(' ')[1:]).strip())
  log.warning('BAD {!r} {}'.format(filename, remainder))
  return 1
 if (not OPTIONS.ignore_missing):
  for (i, hdu) in enumerate(hdulist):
   if (not hdu._checksum):
    log.warning('MISSING {!r} .. Checksum not found in HDU #{}'.format(filename, i))
    return 1
   if (not hdu._datasum):
    log.warning('MISSING {!r} .. Datasum not found in HDU #{}'.format(filename, i))
    return 1
 if (not errors):
  log.info('OK {!r}'.format(filename))
 return errors

def verify_checksums ( filename ) : errors = 0 try : hdulist = fits . open ( filename , checksum = OPTIONS . checksum_kind ) except UserWarning as w : remainder = ( '.. ' + ' ' . join ( str ( w ) . split ( ' ' ) [ 1 : ] ) . strip ( ) ) log . warning ( 'BAD {!r} {}' . format ( filename , remainder ) ) return 1 if ( not OPTIONS . ignore_missing ) : for ( i , hdu ) in enumerate ( hdulist ) : if ( not hdu . _checksum ) : log . warning ( 'MISSING {!r} .. Checksum not found in HDU #{}' . format ( filename , i ) ) return 1 if ( not hdu . _datasum ) : log . warning ( 'MISSING {!r} .. Datasum not found in HDU #{}' . format ( filename , i ) ) return 1 if ( not errors ) : log . info ( 'OK {!r}' . format ( filename ) ) return errors
prints a message if any hdu in filename has a bad checksum or datasum .