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

Function validate_boolean_or_string

pymongo/common.py:194–200  ·  view source on GitHub ↗

Validates that value is True, False, 'true', or 'false'.

(option: str, value: Any)

Source from the content-addressed store, hash-verified

192
193
194def validate_boolean_or_string(option: str, value: Any) -> bool:
195 """Validates that value is True, False, 'true', or 'false'."""
196 if isinstance(value, str):
197 if value not in ("true", "false"):
198 raise ValueError(f"The value of {option} must be 'true' or 'false'")
199 return value == "true"
200 return validate_boolean(option, value)
201
202
203def validate_integer(option: str, value: Any) -> int:

Callers

nothing calls this directly

Calls 1

validate_booleanFunction · 0.90

Tested by

no test coverage detected