HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/jsons/__pycache__/_validation.cpython-311.pyc
�

)�;f�
�	���dZddlmZmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
ed�deegefd	eeeefd
eddfd
�Zeefd	ed
edefd���Zefded	ed
eddfd�ZdS)zo
PRIVATE MODULE: do not import (from) it directly.

This module contains functionality for validating objects.
�)�Union�Sequence�Callable)�cached)�StateHolder�get_class_name)�
_get_lizer)�ValidationError)�	fork_inst�func�clsr�returnNc���t|t��r|D]}t|||����dSt|d���}||j|���<|j�|��dS)a
    Set a validator function for the given ``cls``. The function should accept
    an instance of the type it should validate and must return ``False`` or
    raise any exception in case of a validation failure.
    :param func: the function that takes an instance of type ``cls`` and
    returns a bool (``True`` if the validation was successful).
    :param cls: the type or types that ``func`` is able to validate.
    :param fork_inst: if given, it uses this fork of ``JsonSerializable``.
    :return: None.
    �r
rT)�fully_qualifiedN)�
isinstancer�
set_validatorr�_validators�lower�_classes_validators�append)rr
r�cls_�cls_names     �D/opt/alt/python311/lib/python3.11/site-packages/jsons/_validation.pyrrs����#�x� � �2��	?�	?�D��$�D�I�>�>�>�>�>�	?�	?�"�#�t�<�<�<��26�	��h�n�n�.�.�/��%�,�,�S�1�1�1�1�1�c�:�t||j|j|��S)a
    Return the validator function that would be used for the given ``cls``.
    :param cls: the type for which a deserializer is to be returned.
    :param fork_inst: if given, it uses this fork of ``JsonSerializable``.
    :return: a validator function.
    )r	rrrs  r�
get_validatorr&s(���c�9�0��3�Y�@�@�@r�objc���t||��}d}d}|r:	||��}n-#t$r }|jr
|jd}d}Yd}~nd}~wwxYw|st|���dS)an
    Validate the given ``obj`` with the validator that was registered for
    ``cls``. Raises a ``ValidationError`` if the validation failed.
    :param obj: the object that is to be validated.
    :param cls: the type of which the validator function was registered.
    :param fork_inst: if given, it uses this fork of ``JsonSerializable``.
    :return: None.
    TzValidation failed.rFN)r�	Exception�argsr
)rr
r�	validator�result�msg�errs       r�validater&4s����c�9�-�-�I�
�F�
�C���	��Y�s�^�^�F�F���	�	�	��x�
"��h�q�k���F�F�F�F�F�F�����	�����#��c�"�"�"�#�#s�$�
A�A	�	A)�__doc__�typingrrr�jsons._cacher�jsons._common_implrr�jsons._lizers_implr	�jsons.exceptionsr
�object�bool�typer�callablerr&�rr�<module>r2ss����
-�,�,�,�,�,�,�,�,�,�������:�:�:�:�:�:�:�:�)�)�)�)�)�)�,�,�,�,�,�,�&�	2�2�2���x��~�&�2�
�4��$��'�
(�2��	2�+/�	2�2�2�2�0�&�
@�
@�
�
@��
@�*2�
@�
@�
@���
@� &�#�#�
�#�
�#��#�+/�#�#�#�#�#�#r