phys2cvr.utils.if_declared_force_type

phys2cvr.utils.if_declared_force_type(var, dtype, varname='an input variable', silent=False)[source]

Make sure var is of type dtype.

Parameters:
varstr, int, or float

Variable to change type of

dtypestr

Type to change var to

varnamestr, optional

The name of the variable

silentbool, optional

If True, don’t return any message

Returns:
int, float, str, list, or var

The given var in the given dtype, or var if ‘’ or None

Raises:
NotImplementedError

If dtype is not ‘int’, ‘float’, ‘str’, or ‘list’