MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / validate_string

Function validate_string

pymongo/common.py:249–253  ·  view source on GitHub ↗

Validates that 'value' is an instance of `str`.

(option: str, value: Any)

Source from the content-addressed store, hash-verified

247
248
249def validate_string(option: str, value: Any) -> str:
250 """Validates that 'value' is an instance of `str`."""
251 if isinstance(value, str):
252 return value
253 raise TypeError(f"Wrong type for {option}, value must be an instance of str, not {type(value)}")
254
255
256def validate_string_or_none(option: str, value: Any) -> Optional[str]:

Calls

no outgoing calls

Tested by

no test coverage detected