is_set#
- paramcheckup.types.is_set(value, param_name, kind, kind_name, stacklevel=4, error=True)[source]#
This function checks whether a variable value is of the set type.
- Parameters:
- valueany type
The variable that is tested as being of type set;
- param_namestr
The name of the parameter that received the variable value;
- kindstr
The object where param_name is applied (function, method, class, etc.);
- kind_namestr
The name of the object kind;
- stacklevelint, optional
The stacking level (default is
4);- errorbool, optional
Whether to display error text (True, default) or not (False);
- Returns:
- outputTrue
If variable value IS of the set type;
- raisesTypeError
If variable value is NOT of the set type;
Notes
The following types are considered to be True:
set
Examples
>>> from paramcheckup import types >>> result = types.is_set( value=set(("A", "B", "C")), param_name="alpha", kind="function", kind_name="func_name", stacklevel=3, error=True, ) >>> print(result) True
>>> from paramcheckup import types >>> result = types.is_set( value=["A", "B", "C"], param_name="alpha", kind="function", kind_name="func_name", stacklevel=3, error=True, ) UserWarning at line 2: The parameter `alpha` in function `func_name` must be of type `set`, but its type is `list`.