o
    ¨Ýjî  ã                   @  sú   d Z ddlmZ ddlmZmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ d
Zdeƒ › d�Zed ZG dd„ dƒZG dd„ deeƒZG dd„ deeƒZG dd„ deeƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZeeƒZ dS )zPydantic-specific errors.é    )Úannotations)ÚAnyÚClassVarÚLiteral)ÚSelf)Ú	Qualifier)Ú_repré   )Úgetattr_migration)Úversion_short)ÚPydanticUserErrorÚPydanticUndefinedAnnotationÚPydanticImportErrorÚPydanticSchemaGenerationErrorÚPydanticInvalidForJsonSchemaÚPydanticForbiddenQualifierÚPydanticErrorCodeszhttps://errors.pydantic.dev/z/u/)1zclass-not-fully-definedzcustom-json-schemazdecorator-invalid-fieldszdecorator-missing-argumentszdecorator-missing-fieldzdiscriminator-no-fieldzdiscriminator-alias-typezdiscriminator-needs-literalzdiscriminator-aliaszdiscriminator-validatorzcallable-discriminator-no-tagztyped-dict-versionzmodel-field-overriddenzmodel-field-missing-annotationzconfig-bothzremoved-kwargszcircular-reference-schemaúinvalid-for-json-schemazjson-schema-already-usedzbase-model-instantiatedúundefined-annotationúschema-for-unknown-typeúimport-errorzcreate-model-field-definitionszcreate-model-namespacezvalidator-instance-methodzvalidator-input-typezroot-validator-pre-skipz model-serializer-instance-methodzvalidator-field-config-infozvalidator-v1-signaturezvalidator-signaturezfield-serializer-signaturezmodel-serializer-signaturezmultiple-field-serializerszinvalid-annotated-typeztype-adapter-config-unusedzroot-model-extrazunevaluable-type-annotationz dataclass-init-false-extra-allowzclashing-init-and-init-varzmodel-config-invalid-field-namezwith-config-on-modelzdataclass-on-modelzvalidate-call-typezunpack-typed-dictzoverlapping-unpack-typed-dictzinvalid-self-typez validate-by-alias-and-name-falsec                   @  s$   e Zd ZdZddd	„Zdd
d„ZdS )ÚPydanticErrorMixinzØA mixin class for common functionality shared by all Pydantic-specific errors.

    Attributes:
        message: A message describing the error.
        code: An optional error code from PydanticErrorCodes enum.
    ÚmessageÚstrÚcodeúPydanticErrorCodes | NoneÚreturnÚNonec                C  s   || _ || _d S )N©r   r   )Úselfr   r   © r    úJ/var/www/html/chatgpt/venv/lib/python3.10/site-packages/pydantic/errors.pyÚ__init__Z   s   
zPydanticErrorMixin.__init__c                 C  s&   | j d u r| jS | j› dt› | j › �S )Nz 

For further information visit )r   r   ÚDEV_ERROR_DOCS_URL)r   r    r    r!   Ú__str__^   s   
zPydanticErrorMixin.__str__N)r   r   r   r   r   r   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   r$   r    r    r    r!   r   R   s    
r   c                   @  s   e Zd ZdZdS )r   z1An error raised due to incorrect use of Pydantic.N)r%   r&   r'   r(   r    r    r    r!   r   e   s    r   c                      s0   e Zd ZdZd‡ fdd	„Zeddd„ƒZ‡  ZS )r   zâA subclass of `NameError` raised when handling undefined annotations during `CoreSchema` generation.

    Attributes:
        name: Name of the error, of `None` if not available.
        message: Description of the error.
    Únameú
str | Noner   r   r   r   c                   s   || _ tƒ j|dd� d S )Nr   r   )r)   Úsuperr"   )r   r)   r   ©Ú	__class__r    r!   r"   q   s   z$PydanticUndefinedAnnotation.__init__Ú
name_errorÚ	NameErrorr   c                 C  s   | |j t|ƒd�S )zÙConvert a `NameError` to a `PydanticUndefinedAnnotation` error.

        Args:
            name_error: `NameError` to be converted.

        Returns:
            Converted `PydanticUndefinedAnnotation` error.
        )r)   r   )r)   r   )Úclsr.   r    r    r!   Úfrom_name_erroru   s   
z+PydanticUndefinedAnnotation.from_name_error)r)   r*   r   r   r   r   )r.   r/   r   r   )r%   r&   r'   r(   r"   Úclassmethodr1   Ú__classcell__r    r    r,   r!   r   i   s
    r   c                      ó"   e Zd ZdZd‡ fdd„Z‡  ZS )	r   zŽAn error raised when an import fails due to module changes between V1 and V2.

    Attributes:
        message: Description of the error.
    r   r   r   r   c                   ó   t ƒ j|dd� d S )Nr   ©r   ©r+   r"   ©r   r   r,   r    r!   r"   ‰   ó   zPydanticImportError.__init__©r   r   r   r   ©r%   r&   r'   r(   r"   r3   r    r    r,   r!   r   ‚   ó    r   c                      r4   )	r   zŠAn error raised during failures to generate a `CoreSchema` for some type.

    Attributes:
        message: Description of the error.
    r   r   r   r   c                   r5   )Nr   r6   r7   r8   r,   r    r!   r"   ”   r9   z&PydanticSchemaGenerationError.__init__r:   r;   r    r    r,   r!   r   �   r<   r   c                      r4   )	r   z‘An error raised during failures to generate a JSON schema for some `CoreSchema`.

    Attributes:
        message: Description of the error.
    r   r   r   r   c                   r5   )Nr   r6   r7   r8   r,   r    r!   r"   Ÿ   r9   z%PydanticInvalidForJsonSchema.__init__r:   r;   r    r    r,   r!   r   ˜   r<   r   c                      s>   e Zd ZU dZdddddddœZd	ed
< d‡ fdd„Z‡  ZS )r   zLAn error raised if a forbidden type qualifier is found in a type annotation.ztyping.Requiredztyping.NotRequiredztyping.ReadOnlyztyping.ClassVarzdataclasses.InitVarztyping.Final)ÚrequiredZnot_requiredZ	read_onlyZ	class_varZinit_varÚfinalzClassVar[dict[Qualifier, str]]Ú_qualifier_repr_mapÚ	qualifierr   Ú
annotationr   r   r   c                   s.   t ƒ jdt |¡›d| j| ›d�d d� d S )NzThe annotation z contains the z? type qualifier, which is invalid in the context it is defined.r   )r+   r"   r   Zdisplay_as_typer?   )r   r@   rA   r,   r    r!   r"   ¯   s   
ûz#PydanticForbiddenQualifier.__init__)r@   r   rA   r   r   r   )r%   r&   r'   r(   r?   Ú__annotations__r"   r3   r    r    r,   r!   r   £   s   
 ú	r   N)!r(   Ú
__future__r   Z_annotationsÚtypingr   r   r   Ztyping_extensionsr   Ztyping_inspection.introspectionr   Zpydantic._internalr   Z
_migrationr
   Úversionr   Ú__all__r#   r   r   ÚRuntimeErrorr   r/   r   ÚImportErrorr   r   r   r   r%   Ú__getattr__r    r    r    r!   Ú<module>   s*    ÿ5