def validate_header_size(self, value): if not isinstance(value, int): raise AttributeError( 'Header size must be integer. Header size provided: ' + str(value)) if value not in MBN_HDRS.keys(): raise AttributeError('Invalid header size provided: ' + str(value) + '\n' ' ' + 'Supported header sizes are: ' + str(MBN_HDRS.keys()))
def validate_header_size(value, version): if not isinstance(value, (int, long)): raise AttributeError( 'Header size must be integer. Header size provided: ' + str(value)) if version != MBN_HDR_VERSION_6 and value not in [ s for s, v in MBN_HDRS.keys() ]: raise AttributeError( 'Invalid header size provided: {0}\n ' 'Supported header sizes for MBN version {1} are: {2}'.format( value, version, sorted([s for s, v in MBN_HDRS.keys() if v == version])))
def validate_header_size(self, value): if not isinstance(value, int): raise AttributeError('Header size must be integer. Header size provided: ' + str(value)) if value not in MBN_HDRS.keys(): raise AttributeError('Invalid header size provided: ' + str(value) + '\n' ' ' + 'Supported header sizes are: ' + str(MBN_HDRS.keys()))