def diagnose_binaryblock(klass, binaryblock, endianness=None): ''' Run checks over header binary data, return string ''' hdr = klass(binaryblock, endianness=endianness, check=False) battrun = BatteryRunner(klass._get_checks()) reports = battrun.check_only(hdr) return '\n'.join([report.message for report in reports if report.message])
def check_fix(self, logger=imageglobals.logger, error_level=imageglobals.error_level): ''' Check header data with checks ''' battrun = BatteryRunner(self.__class__._get_checks()) self, reports = battrun.check_fix(self) for report in reports: report.log_raise(logger, error_level)