Skip to content

Commit 13085ff

Browse files
authored
PYTHON-5758 Remove unused validation functions (#2733)
1 parent 80c3ff2 commit 13085ff

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

pymongo/common.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,6 @@ def validate_readable(option: str, value: Any) -> Optional[str]:
233233
return value
234234

235235

236-
def validate_positive_integer_or_none(option: str, value: Any) -> Optional[int]:
237-
"""Validate that 'value' is a positive integer or None."""
238-
if value is None:
239-
return value
240-
return validate_positive_integer(option, value)
241-
242-
243236
def validate_non_negative_integer_or_none(option: str, value: Any) -> Optional[int]:
244237
"""Validate that 'value' is a positive integer or 0 or None."""
245238
if value is None:
@@ -261,20 +254,6 @@ def validate_string_or_none(option: str, value: Any) -> Optional[str]:
261254
return validate_string(option, value)
262255

263256

264-
def validate_int_or_basestring(option: str, value: Any) -> Union[int, str]:
265-
"""Validates that 'value' is an integer or string."""
266-
if isinstance(value, int):
267-
return value
268-
elif isinstance(value, str):
269-
try:
270-
return int(value)
271-
except ValueError:
272-
return value
273-
raise TypeError(
274-
f"Wrong type for {option}, value must be an integer or a string, not {type(value)}"
275-
)
276-
277-
278257
def validate_non_negative_int_or_basestring(option: Any, value: Any) -> Union[int, str]:
279258
"""Validates that 'value' is an integer or string."""
280259
if isinstance(value, int):
@@ -817,16 +796,6 @@ def validate_server_monitoring_mode(option: str, value: str) -> str:
817796
"waitqueuetimeoutms",
818797
]
819798

820-
_AUTH_OPTIONS = frozenset(["authmechanismproperties"])
821-
822-
823-
def validate_auth_option(option: str, value: Any) -> tuple[str, Any]:
824-
"""Validate optional authentication parameters."""
825-
lower, value = validate(option, value)
826-
if lower not in _AUTH_OPTIONS:
827-
raise ConfigurationError(f"Unknown option: {option}. Must be in {_AUTH_OPTIONS}")
828-
return option, value
829-
830799

831800
def _get_validator(
832801
key: str, validators: dict[str, Callable[[Any, Any], Any]], normed_key: Optional[str] = None

0 commit comments

Comments
 (0)