check_raise#

check_raise(obj, mtype: str, scitype: str = None, var_name: str = 'input')[source]#

Check object for compliance with mtype specification, raise errors.

Parameters:
obj - object to check
mtype: str or list of str, mtype to check obj as

valid mtype strings are in datatypes.MTYPE_REGISTER (1st column)

scitype: str, optional, scitype to check obj as; default = inferred from mtype

if inferred from mtype, list elements of mtype need not have same scitype valid mtype strings are in datatypes.SCITYPE_REGISTER (1st column)

var_name: str, optional, default=”input” - name of input in error messages
Returns:
valid: bool - True if obj complies with the specification

same as when return argument of check_is_mtype is True otherwise raises an error

Raises:
TypeError with informative message if obj does not comply
TypeError if no checks defined for mtype/scitype combination
ValueError if mtype input argument is not of expected type