
    g                        d Z ddlmZ ddlZddlmZmZ ddlm	Z	 ddl
mZ dZd	 e        d
Zed   Z G d d      Z G d dee      Z G d dee      Z G d dee      Z G d de      Z G d de      Z e	e      Zy)zPydantic-specific errors.    )annotationsN)LiteralSelf   )getattr_migration)version_short)PydanticUserErrorPydanticUndefinedAnnotationPydanticImportErrorPydanticSchemaGenerationErrorPydanticInvalidForJsonSchemaPydanticErrorCodeszhttps://errors.pydantic.dev/z/u/)0zclass-not-fully-definedzcustom-json-schemaz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-config-basezvalidator-no-fieldszvalidator-invalid-fieldsz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-typec                       e Zd ZdZddZddZy)PydanticErrorMixinzA 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.
    c                    || _         || _        y )Nmessagecode)selfr   r   s      D/var/www/openai/venv/lib/python3.12/site-packages/pydantic/errors.py__init__zPydanticErrorMixin.__init__U   s    	    c                t    | j                   | j                  S | j                   dt         | j                    S )Nz 

For further information visit )r   r   DEV_ERROR_DOCS_URL)r   s    r   __str__zPydanticErrorMixin.__str__Y   s:    99<<ll^#EFXEYZ^ZcZcYdeer   N)r   strr   zPydanticErrorCodes | NonereturnNone)r!   r    )__name__
__module____qualname____doc__r   r    r   r   r   r   M   s    fr   r   c                      e Zd ZdZy)r	   z1An error raised due to incorrect use of Pydantic.N)r#   r$   r%   r&   r'   r   r   r	   r	   `   s    ;r   r	   c                  6     e Zd ZdZd fdZedd       Z xZS )r
   zA subclass of `NameError` raised when handling undefined annotations during `CoreSchema` generation.

    Attributes:
        name: Name of the error.
        message: Description of the error.
    c                6    || _         t        | 	  |d       y )Nr   r   )namesuperr   )r   r+   r   	__class__s      r   r   z$PydanticUndefinedAnnotation.__init__l   s    	/EFr   c                    	 |j                   } | |t	        |            S # t        $ r1 t        j                  dt	        |            j                  d      }Y Lw xY w)zConvert a `NameError` to a `PydanticUndefinedAnnotation` error.

        Args:
            name_error: `NameError` to be converted.

        Returns:
            Converted `PydanticUndefinedAnnotation` error.
        z	.*'(.+?)'r   )r+   r   )r+   AttributeErrorresearchr    group)cls
name_errorr+   s      r   from_name_errorz+PydanticUndefinedAnnotation.from_name_errorp   sV    	E??D c*o66  	E99\3z?;AA!DD	Es   ! 7AA)r+   r    r   r    r!   r"   )r4   	NameErrorr!   r   )r#   r$   r%   r&   r   classmethodr5   __classcell__r-   s   @r   r
   r
   d   s"    G 7 7r   r
   c                  $     e Zd ZdZd fdZ xZS )r   zAn error raised when an import fails due to module changes between V1 and V2.

    Attributes:
        message: Description of the error.
    c                (    t         |   |d       y )Nr   r   r,   r   r   r   r-   s     r   r   zPydanticImportError.__init__   s    ~6r   r   r    r!   r"   r#   r$   r%   r&   r   r8   r9   s   @r   r   r      s    7 7r   r   c                  $     e Zd ZdZd fdZ xZS )r   zAn error raised during failures to generate a `CoreSchema` for some type.

    Attributes:
        message: Description of the error.
    c                (    t         |   |d       y )Nr   r<   r=   r>   s     r   r   z&PydanticSchemaGenerationError.__init__       '@Ar   r?   r@   r9   s   @r   r   r          B Br   r   c                  $     e Zd ZdZd fdZ xZS )r   zAn error raised during failures to generate a JSON schema for some `CoreSchema`.

    Attributes:
        message: Description of the error.
    c                (    t         |   |d       y )Nr   r<   r=   r>   s     r   r   z%PydanticInvalidForJsonSchema.__init__   rC   r   r?   r@   r9   s   @r   r   r      rD   r   r   )r&   
__future__r   _annotationsr0   typing_extensionsr   r   
_migrationr   versionr   __all__r   r   r   	TypeErrorr	   r6   r
   ImportErrorr   r   r   r#   __getattr__r'   r   r   <module>rP      s     2 	 + ) " 4MO3DCH /1 hf f&<*I <7"4i 7:7,k 7B$5 BB#4 B  )r   