Viewing File: /opt/hc_python/lib/python3.12/site-packages/pydantic/plugin/__pycache__/__init__.cpython-312.pyc

�

e��g����UdZddlmZddlmZmZmZddlmZm	Z	m
Z
ddlmZm
Z
mZdZdZded	<Gd
�de�ZedZded
<Gd�de
�ZGd�de
�ZGd�dee
�ZGd�dee
�ZdZded<Gd�dee
�Zy)z�Usage docs: https://docs.pydantic.dev/2.8/concepts/plugins#build-a-plugin

Plugin interface for Pydantic plugins, and related types.
�)�annotations)�Any�Callable�
NamedTuple)�
CoreConfig�
CoreSchema�ValidationError)�Literal�Protocol�	TypeAlias)�PydanticPluginProtocol�BaseValidateHandlerProtocol�ValidatePythonHandlerProtocol�ValidateJsonHandlerProtocol�ValidateStringsHandlerProtocol�NewSchemaReturns�SchemaTypePath�
SchemaKind�vtuple[ValidatePythonHandlerProtocol | None, ValidateJsonHandlerProtocol | None, ValidateStringsHandlerProtocol | None]rrc�&�eZdZUdZded<ded<y)rzQPath defining where `schema_type` was defined, or where `TypeAdapter` was called.�str�module�nameN)�__name__�
__module__�__qualname__�__doc__�__annotations__���G/opt/hc_python/lib/python3.12/site-packages/pydantic/plugin/__init__.pyrrs��[��K�

�Ir r)�	BaseModel�TypeAdapter�	dataclass�create_model�
validate_callrc�4�eZdZdZ														dd�Zy)r
z5Protocol defining the interface for Pydantic plugins.c��td��)a�This method is called for each plugin every time a new [`SchemaValidator`][pydantic_core.SchemaValidator]
        is created.

        It should return an event handler for each of the three validation methods, or `None` if the plugin does not
        implement that method.

        Args:
            schema: The schema to validate against.
            schema_type: The original type which the schema was created from, e.g. the model class.
            schema_type_path: Path defining where `schema_type` was defined, or where `TypeAdapter` was called.
            schema_kind: The kind of schema to validate against.
            config: The config to use for validation.
            plugin_settings: Any plugin settings.

        Returns:
            A tuple of optional event handlers for each of the three validation methods -
                `validate_python`, `validate_json`, `validate_strings`.
        z9Pydantic plugins should implement `new_schema_validator`.)�NotImplementedError)�self�schema�schema_type�schema_type_path�schema_kind�config�plugin_settingss       r!�new_schema_validatorz+PydanticPluginProtocol.new_schema_validator(s��:"�"]�^�^r N)r+rr,rr-rr.rr/zCoreConfig | Noner0zdict[str, object]�returnr)rrrrr1rr r!r
r
%sV��?�_��_��_�)�	_�
 �_�"�
_�+�_�
�_r r
c�6�eZdZUdZded<	dd�Zd	d�Zd
d�Zy)rz�Base class for plugin callbacks protocols.

    You shouldn't implement this protocol directly, instead use one of the subclasses with adds the correctly
    typed `on_error` method.
    zCallable[..., None]�on_enterc��y)z{Callback to be notified of successful validation.

        Args:
            result: The result of the validation.
        Nr)r*�results  r!�
on_successz&BaseValidateHandlerProtocol.on_successR���	r c��y)znCallback to be notified of validation errors.

        Args:
            error: The validation error.
        Nr)r*�errors  r!�on_errorz$BaseValidateHandlerProtocol.on_errorZr8r c��y)z�Callback to be notified of validation exceptions.

        Args:
            exception: The exception raised during validation.
        Nr)r*�	exceptions  r!�on_exceptionz(BaseValidateHandlerProtocol.on_exceptionbr8r N)r6rr2�None)r:r	r2r?)r=�	Exceptionr2r?)rrrrrr7r;r>rr r!rrHs!���"�!�E���r rc�:�eZdZdZddddd�											dd�Zy)rz4Event handler for `SchemaValidator.validate_python`.N)�strict�from_attributes�context�
self_instancec��y)aTCallback to be notified of validation start, and create an instance of the event handler.

        Args:
            input: The input to be validated.
            strict: Whether to validate the object in strict mode.
            from_attributes: Whether to validate objects as inputs by extracting attributes.
            context: The context to use for validation, this is passed to functional validators.
            self_instance: An instance of a model to set attributes on from validation, this is used when running
                validation from the `__init__` method of a model.
        Nr)r*�inputrBrCrDrEs      r!r4z&ValidatePythonHandlerProtocol.on_enterns��&	
r )rGrrB�bool | NonerCrHrD�dict[str, Any] | NonerE�
Any | Noner2r?�rrrrr4rr r!rrksR��>�#�'+�)-�$(�
��
��	
�
%�
�'�

�"�
�
�
r rc�4�eZdZdZdddd�									dd�Zy)rz2Event handler for `SchemaValidator.validate_json`.N)rBrDrEc��y)a�Callback to be notified of validation start, and create an instance of the event handler.

        Args:
            input: The JSON data to be validated.
            strict: Whether to validate the object in strict mode.
            context: The context to use for validation, this is passed to functional validators.
            self_instance: An instance of a model to set attributes on from validation, this is used when running
                validation from the `__init__` method of a model.
        Nr)r*rGrBrDrEs     r!r4z$ValidateJsonHandlerProtocol.on_enter�s��"	
r )
rGzstr | bytes | bytearrayrBrHrDrIrErJr2r?rKrr r!rr�sE��<�#�)-�$(�

�&�
��	
�
'�
�"�

�
�
r rzdict[str, StringInput]�StringInputc�.�eZdZdZddd�							dd�Zy)rz5Event handler for `SchemaValidator.validate_strings`.N)rBrDc��y)aICallback to be notified of validation start, and create an instance of the event handler.

        Args:
            input: The string data to be validated.
            strict: Whether to validate the object in strict mode.
            context: The context to use for validation, this is passed to functional validators.
        Nr)r*rGrBrDs    r!r4z'ValidateStringsHandlerProtocol.on_enter�s��	
r )rGrNrBrHrDrIr2r?rKrr r!rr�s3��?�<@�bf�

� �

�-8�

�J_�

�	
�

r rN)r�
__future__r�typingrrr�
pydantic_corerrr	�typing_extensionsr
rr�__all__rrrrr
rrrrNrrr r!�<module>rVs����
#�,�,�A�A�:�:�	��W��)�W��Z�� � h�i�
�I�i� _�X� _�F �(� �F
�$?��
�2
�"=�x�
�.2��Y�1�

�%@�(�

r 
Back to Directory File Manager