pyvista.core._validation.check.check_contains

Contents

pyvista.core._validation.check.check_contains#

check_contains(
container: Container[Any],
/,
must_contain: Any,
*,
name: str = 'Input',
) None[source]#

Check if an item is in a container.

Parameters:
containerAny

Container to check.

must_containAny

Item which must be in the container.

namestr, default: “Input”

Variable name to use in the error messages if any are raised.

Raises:
ValueError

If the item is not in the container.

Examples

Check if "A" is in a list of strings.

>>> from pyvista import _validation
>>> _validation.check_contains(['A', 'B', 'C'], must_contain='A')