pyvista.core._validation.check.check_contains

Contents

pyvista.core._validation.check.check_contains#

check_contains(*, item, container, name='Input')[source]#

Check if an item is in a container.

Parameters:
itemAny

Item to check.

containerAny

Container the item is expected to be in.

namestr, default: “Input”

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

Raises:
ValueError

If the string is not in the iterable.

Examples

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

>>> from pyvista import _validation
>>> _validation.check_contains(item="A", container=["A", "B", "C"])