pyvista_validation.check.check_string#
- pyvista_validation.check.check_string(obj, *, allow_subclass=True, name='Object')#
Check if an object is an instance of
str.- Parameters:
- objstr
Object to check.
- allow_subclassbool, default: True
If
True, the object’s type must bestror a subclass ofstr. Otherwise, subclasses are not allowed.- namestr, default: “Object”
Variable name to use in the error messages if any are raised.
- Returns:
- str
The input, unchanged. Type checkers see it as a string.
- Raises:
- TypeError
If input is not an instance of
str.
Examples
Check if an object is a string.
>>> from pyvista_validation import check_string >>> check_string('eggs') 'eggs'