U
    ={f                     @  s   U d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
 ddlmZmZmZ dZdZded	< G d
d deZed Zded< G dd deZG dd deZG dd deeZG dd deeZdZded< G dd deeZdS )zUsage docs: https://docs.pydantic.dev/2.7/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
SchemaKindvtuple[ValidatePythonHandlerProtocol | None, ValidateJsonHandlerProtocol | None, ValidateStringsHandlerProtocol | None]r   r   c                   @  s"   e Zd ZU dZded< ded< dS )r   zQPath defining where `schema_type` was defined, or where `TypeAdapter` was called.strmodulenameN)__name__
__module____qualname____doc____annotations__ r   r   W/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/pydantic/plugin/__init__.pyr      s   
r   )Z	BaseModelZTypeAdapter	dataclassZcreate_modelZvalidate_callr   c                   @  s*   e Zd ZdZdddddddd	d
dZdS )r   z5Protocol defining the interface for Pydantic plugins.r   r   r   r   zCoreConfig | Nonezdict[str, object]r   )schemaschema_typeschema_type_pathschema_kindconfigplugin_settingsreturnc                 C  s   t ddS )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`.N)NotImplementedError)selfr    r!   r"   r#   r$   r%   r   r   r   new_schema_validator'   s    z+PydanticPluginProtocol.new_schema_validatorN)r   r   r   r   r)   r   r   r   r   r   $   s   r   c                   @  sJ   e Zd ZU dZded< dddddZd	dd
ddZdddddZdS )r   zBase 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.
    zCallable[(Ellipsis, None)]on_enterr   None)resultr&   c                 C  s   dS )z{Callback to be notified of successful validation.

        Args:
            result: The result of the validation.
        Nr   )r(   r,   r   r   r   
on_successQ   s    z&BaseValidateHandlerProtocol.on_successr   )errorr&   c                 C  s   dS )znCallback to be notified of validation errors.

        Args:
            error: The validation error.
        Nr   )r(   r.   r   r   r   on_errorY   s    z$BaseValidateHandlerProtocol.on_error	Exception)	exceptionr&   c                 C  s   dS )zCallback to be notified of validation exceptions.

        Args:
            exception: The exception raised during validation.
        Nr   )r(   r1   r   r   r   on_exceptiona   s    z(BaseValidateHandlerProtocol.on_exceptionN)r   r   r   r   r   r-   r/   r2   r   r   r   r   r   G   s
   
r   c                   @  s4   e Zd ZdZdddddddddddd	d
dZdS )r   z4Event handler for `SchemaValidator.validate_python`.N)strictfrom_attributescontextself_instancer   bool | Nonedict[str, Any] | None
Any | Noner+   )inputr3   r4   r5   r6   r&   c                C  s   dS )aT  Callback 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(   r:   r3   r4   r5   r6   r   r   r   r*   m   s    z&ValidatePythonHandlerProtocol.on_enterr   r   r   r   r*   r   r   r   r   r   j   s   r   c                   @  s0   e Zd ZdZdddddddddd	d
dZdS )r   z2Event handler for `SchemaValidator.validate_json`.N)r3   r5   r6   zstr | bytes | bytearrayr7   r8   r9   r+   )r:   r3   r5   r6   r&   c                C  s   dS )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(   r:   r3   r5   r6   r   r   r   r*      s    z$ValidateJsonHandlerProtocol.on_enterr;   r   r   r   r   r      s
   r   zdict[str, StringInput]StringInputc                   @  s,   e Zd ZdZddddddddd	d
ZdS )r   z5Event handler for `SchemaValidator.validate_strings`.N)r3   r5   r<   r7   r8   r+   )r:   r3   r5   r&   c                C  s   dS )aI  Callback 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(   r:   r3   r5   r   r   r   r*      s    
z'ValidateStringsHandlerProtocol.on_enterr;   r   r   r   r   r      s    r   N)r   
__future__r   typingr   r   r   Zpydantic_corer   r   r   Ztyping_extensionsr	   r
   r   __all__r   r   r   r   r   r   r   r   r<   r   r   r   r   r   <module>   s   ##