### mkdocstrings plugin configuration in mkdocs.yaml Source: https://deepwiki.com/python-validators/validators/5-documentation-system Configures the mkdocstrings plugin to generate API documentation from Python docstrings, with show_root_heading enabled and an import for the requests documentation inventory. ```yaml plugins: - mkdocstrings: handlers: python: options: show_root_heading: true import: - https://docs.python-requests.org/en/master/objects.inv ``` -------------------------------- ### Version Management - __version__ constant Source: https://deepwiki.com/python-validators/validators/2.1-package-structure Defines the package version as a simple string constant, located at src/validators/__init__.py line 115. The version follows semantic versioning and is updated with each release as documented in CHANGES.md. ```python __version__ = "0.35.0" ``` -------------------------------- ### Parse validators package for documentation generation Source: https://deepwiki.com/python-validators/validators/3.3-internationalization-validators Parses the validators package source to extract imported namespaces for automatic documentation generation. Yields module and namespace pairs from ImportFrom nodes in the AST. ```python def _parse_package(source: Path): """Parse validators package.""" v_ast = parse(source.read_text(), source) for namespace in (node for node in v_ast.body if isinstance(node, ImportFrom)): if not namespace.module: continue yield (namespace.module, namespace.names) ``` -------------------------------- ### length(value, min_val=None, max_val=None) Source: https://deepwiki.com/python-validators/validators/3.5-general-purpose-validators Validates that a string's length meets specified constraints. Supports minimum, maximum, and exact length checks. ```APIDOC ## [FUNCTION] length(value, min_val=None, max_val=None) ### Description Validates that a string's length meets specified constraints. Supports minimum, maximum, and exact length checks. ### Method Function call ### Endpoint `length(value, min_val=None, max_val=None)` ### Parameters #### Arguments - **value** (str) - Required - The string to validate. - **min_val** (int) - Optional - The minimum length required. - **max_val** (int) - Optional - The maximum length allowed. ### Request Example ```python length('something', min_val=2) length('something', min_val=9, max_val=9) length('something', max_val=5) ``` ### Response #### Success Response Returns a boolean indicating whether the string length meets the constraints. #### Response Example ```python True ``` ``` -------------------------------- ### Function Argument Capture with _func_args_as_dict Source: https://deepwiki.com/python-validators/validators/2-core-architecture Captures a function's positional and keyword arguments as an ordered dictionary for error reporting. Used by the validation framework to store arguments in ValidationError instances. ```python def _func_args_as_dict(func: Callable[..., Any], *args: Any, **kwargs: Any): """Return function's positional and key value arguments as an ordered dictionary.""" return dict( list(zip(dict.fromkeys(chain(getfullargspec(func)[0], kwargs.keys())), args)) + list(kwargs.items()) ) ``` -------------------------------- ### Export List Management - __all__ tuple Source: https://deepwiki.com/python-validators/validators/2.1-package-structure Defines the public API of the validators package, organized to match the import structure. The __all__ tuple is located at src/validators/__init__.py lines 37-113. ```python __all__ = ( # Core utilities "ValidationError", "validator", # Network validators "domain", "email", "hostname", "ipv4", "ipv6", # Financial validators "amex", "visa", "mastercard", "card_number", "iban", # ... additional functions ) ``` -------------------------------- ### between(value, min_val=None, max_val=None) Source: https://deepwiki.com/python-validators/validators/3.5-general-purpose-validators Validates that a value falls within a specified range. Supports integers, floats, and datetime objects. ```APIDOC ## [FUNCTION] between(value, min_val=None, max_val=None) ### Description Validates that a value falls within a specified range. Supports integers, floats, and datetime objects. ### Method Function call ### Endpoint `between(value, min_val=None, max_val=None)` ### Parameters #### Arguments - **value** (int, float, datetime) - Required - The value to validate. - **min_val** (int, float, datetime) - Optional - The minimum allowed value. - **max_val** (int, float, datetime) - Optional - The maximum allowed value. ### Request Example ```python between(5, min_val=2) between(13.2, min_val=13, max_val=14) between(datetime(2000, 11, 11), min_val=datetime(1999, 11, 11)) ``` ### Response #### Success Response Returns a boolean indicating whether the value is within the range. #### Response Example ```python True ``` ``` -------------------------------- ### Luhn Algorithm Implementation in card_number function Source: https://deepwiki.com/python-validators/validators/3.2-financial-validators Core validation logic using the Luhn algorithm. Converts the card number string to a list of integers, calculates sums for odd and even positions (with doubling and digit summing for even positions), and returns true if the total sum is divisible by 10. ```python digits = list(map(int, value)) odd_sum = sum(digits[-1::-2]) even_sum = sum(sum(divmod(2 * d, 10)) for d in digits[-2::-2]) return (odd_sum + even_sum) % 10 == 0 ``` -------------------------------- ### between(value, min_val, max_val) Source: https://deepwiki.com/python-validators/validators/3.5-general-purpose-validators Validates that a value falls within a specified range. Supports any comparable type and optional boundaries using AbsMin and AbsMax for unbounded ranges. ```APIDOC ## between(value, min_val, max_val) ### Description Validates that a value falls within a specified range. Supports any comparable type and optional boundaries using AbsMin and AbsMax for unbounded ranges. ### Parameters - **value** (PossibleValueTypes) - Required - The value to validate - **min_val** (Union[PossibleValueTypes, AbsMin, None]) - Optional - Minimum boundary - **max_val** (Union[PossibleValueTypes, AbsMax, None]) - Optional - Maximum boundary ### Errors - **ValueError** - Raised when min_val > max_val - **TypeError** - Raised when type mismatch occurs during comparison - **ValidationError** - Returned when value is outside the specified range ``` -------------------------------- ### Parametrized test for valid Russian INN values Source: https://deepwiki.com/python-validators/validators/3.3-internationalization-validators Uses pytest parametrization to test that valid Russian individual tax numbers (INN) return true. The test function asserts that ru_inn(value) returns a truthy result for each valid INN. ```python @pytest.mark.parametrize( ("value",), [ ("2222058686",), ("7709439560",), ("5003052454",), # ... more valid INNs ], ) def test_returns_true_on_valid_ru_inn(value: str): """Test returns true on valid russian individual tax number.""" assert ru_inn(value) ``` -------------------------------- ### length(value, min_val, max_val) Source: https://deepwiki.com/python-validators/validators/3.5-general-purpose-validators Validates that the length of a string falls within a specified range. Delegates to the between validator internally and returns a boolean result. ```APIDOC ## length(value, min_val, max_val) ### Description Validates that the length of a string falls within a specified range. Delegates to the between validator internally and returns a boolean result. ### Parameters - **value** (str) - Required - The string to validate - **min_val** (int, optional) - Optional - Minimum length boundary - **max_val** (int, optional) - Optional - Maximum length boundary ### Errors - **ValueError** - Raised when min_val or max_val is negative ``` -------------------------------- ### Length Validator: Negative Boundary Validation Source: https://deepwiki.com/python-validators/validators/3.5-general-purpose-validators Validates that length boundaries are non-negative before delegating to the between validator. Raises ValueError with a specific message if min_val or max_val is negative. ```python if min_val is not None and min_val < 0: raise ValueError("Length cannot be negative. `min_val` is less than zero.") if max_val is not None and max_val < 0: raise ValueError("Length cannot be negative. `max_val` is less than zero.") ``` -------------------------------- ### ru_inn validator decorator pattern Source: https://deepwiki.com/python-validators/validators/3.3-internationalization-validators Shows the standard i18n validator pattern using the @validator decorator from validators.utils. The ru_inn function validates Russian INN (Taxpayer Identification Number). ```python from validators.utils import validator @validator def ru_inn(value: str): """Validate a Russian INN (Taxpayer Identification Number).""" # Implementation details... ``` -------------------------------- ### Parametrized test for invalid Russian INN values Source: https://deepwiki.com/python-validators/validators/3.3-internationalization-validators Uses pytest parametrization to test that invalid Russian individual tax numbers (INN) return a ValidationError. The test function asserts that ru_inn(value) returns an instance of ValidationError for each invalid INN. ```python @pytest.mark.parametrize( ("value",), [ ("2222058687",), # Invalid control digit ("7709439561",), # Invalid control digit # ... more invalid INNs ], ) def test_returns_false_on_valid_ru_inn(value: str): """Test returns true on valid russian individual tax number.""" assert isinstance(ru_inn(value), ValidationError) ``` -------------------------------- ### base64() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid Base64 encoding, widely used for encoding binary data. Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] base64() ### Description Validates whether a string is a valid Base64 encoding, widely used for encoding binary data. Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `base64(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as Base64 encoded data. ### Response #### Success Response - **True** (boolean) - If the input is a valid Base64 encoded string. #### Error Response - **ValidationError** - If the input is not a valid Base64 encoded string. ### Example ```python from validators import base64 base64('SGVsbG8gV29ybGQ=') # True ``` ``` -------------------------------- ### md5() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid MD5 hash (32 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] md5() ### Description Validates whether a string is a valid MD5 hash (32 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `md5(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as an MD5 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid MD5 hash. #### Error Response - **ValidationError** - If the input is not a valid MD5 hash. ### Example ```python from validators import md5 md5('d41d8cd98f00b204e9800998ecf8427e') # True ``` ``` -------------------------------- ### sha1() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid SHA-1 hash (40 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] sha1() ### Description Validates whether a string is a valid SHA-1 hash (40 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `sha1(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as a SHA-1 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid SHA-1 hash. #### Error Response - **ValidationError** - If the input is not a valid SHA-1 hash. ### Example ```python from validators import sha1 sha1('da39a3ee5e6b4b0d3255bfef95601890afd80709') # True ``` ``` -------------------------------- ### base58() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid Base58 encoding, commonly used in cryptocurrency addresses. Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] base58() ### Description Validates whether a string is a valid Base58 encoding, commonly used in cryptocurrency addresses. Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `base58(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as Base58 encoded data. ### Response #### Success Response - **True** (boolean) - If the input is a valid Base58 encoded string. #### Error Response - **ValidationError** - If the input is not a valid Base58 encoded string. ### Example ```python from validators import base58 base58('1BoatSLRHtKNngkdXEeobR76b53LETtpyT') # True ``` ``` -------------------------------- ### sha384() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid SHA-384 hash (96 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] sha384() ### Description Validates whether a string is a valid SHA-384 hash (96 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `sha384(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as a SHA-384 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid SHA-384 hash. #### Error Response - **ValidationError** - If the input is not a valid SHA-384 hash. ### Example ```python from validators import sha384 sha384('38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b') # True ``` ``` -------------------------------- ### sha256() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid SHA-256 hash (64 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] sha256() ### Description Validates whether a string is a valid SHA-256 hash (64 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `sha256(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as a SHA-256 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid SHA-256 hash. #### Error Response - **ValidationError** - If the input is not a valid SHA-256 hash. ### Example ```python from validators import sha256 sha256('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') # True ``` ``` -------------------------------- ### sha512() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid SHA-512 hash (128 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] sha512() ### Description Validates whether a string is a valid SHA-512 hash (128 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `sha512(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as a SHA-512 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid SHA-512 hash. #### Error Response - **ValidationError** - If the input is not a valid SHA-512 hash. ### Example ```python from validators import sha512 sha512('cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e') # True ``` ``` -------------------------------- ### sha224() Source: https://deepwiki.com/python-validators/validators/3.4-cryptographic-validators Validates whether a string is a valid SHA-224 hash (56 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ```APIDOC ## [FUNCTION] sha224() ### Description Validates whether a string is a valid SHA-224 hash (56 hexadecimal characters). Returns True for valid input and ValidationError for invalid input. ### Method Function ### Endpoint `sha224(value)` ### Parameters #### Input - **value** (string) - Required - The string to validate as a SHA-224 hash. ### Response #### Success Response - **True** (boolean) - If the input is a valid SHA-224 hash. #### Error Response - **ValidationError** - If the input is not a valid SHA-224 hash. ### Example ```python from validators import sha224 sha224('d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f') # True ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.