o
    $6d                     @  sL  U d Z ddlmZ ddlZddlZddlZddlZddlmZ ddlm	Z
 ddlmZmZ ddlmZ ddlZddlZddlmZ dd	lmZmZ d
dlmZ d
dlmZmZmZmZmZmZmZ d
dlm Z  d
dlm!Z! ej"rwd
dl#m$Z$ ne!Z%eZ&de'd< G dd dej(ddZ)G dd de)ddZ*G dd dej+Z,ej-ddi ej.G dd dZ/ej-ddi ej.G dd dZ0G dd dej(Z1e2ddi d d!d"dd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/d0d1dd2dd3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dd>dZ3efe&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&d?dedNdOZ	e4e5e	j6Z7e78dK G dPdQ dQej+Z9efddRdfdSdTZ:ej-ddi ej.G dUdV dVZ;e<dWZ=ej>eddddd0dXdgd[d\Z?ej>dhd^d\Z?	diddddd0ed_djdcd\Z?dS )kzDefining fields on models.    )annotationsN)copy)Field)AnyClassVar)warn)PydanticUndefined)LiteralUnpack   )types)_decorators_fields	_generics_internal_dataclass_repr_typing_extra_utils)PydanticUserError)PydanticDeprecatedSince20)ReprArgsr   _Unsetc                   @  s  e Zd ZU dZded< ded< ded< ded	< d
ed< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< d ed!< ded"< d#ed$< ded%< ded&< d'ed(< ded)< ded*< d+S ),_FromFieldInfoInputsz[This class exists solely to add type checking for the `**kwargs` in `FieldInfo.from_field`.type[Any] | None
annotationtyping.Callable[[], Any] | Nonedefault_factory
str | Nonealias
int | Nonealias_priority%str | AliasPath | AliasChoices | Nonevalidation_aliasserialization_aliastitledescriptionlist[Any] | Noneexamplesbool | Noneexcludefloat | Nonegtgeltlemultiple_ofstrict
min_length
max_lengthpatternallow_inf_nan
max_digitsdecimal_placesz(Literal['smart', 'left_to_right'] | None
union_modediscriminator?dict[str, Any] | typing.Callable[[dict[str, Any]], None] | Nonejson_schema_extrafrozenvalidate_defaultboolreprinit_varkw_onlyN__name__
__module____qualname____doc____annotations__ rG   rG   fC:\Users\jesus\OneDrive\Desktop\erpjis_fastapi\backend\jisbackend\Lib\site-packages\pydantic/fields.pyr   "   s@   
 r   F)totalc                   @  s   e Zd ZU dZded< dS )_FieldInfoInputszYThis class exists solely to add type checking for the `**kwargs` in `FieldInfo.__init__`.r   defaultNrA   rG   rG   rG   rH   rJ   E   s   
 rJ   c                   @  s  e Zd ZU dZded< ded< ded< ded	< d
ed< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< d Zejej	ej
ejejejejejd!d!d!d!d!d"Zd#ed$< dTd)d*ZeefdUd-d.ZedVd0d1ZedWd2d3ZedXd6d7ZedYd:d;ZedZd=d>Zed[d@dAZdBdCd\dEdFZd]dGdHZd^dIdJZd_dOdPZd`dRdSZ d!S )a	FieldInfoav  This class holds information about a field.

    `FieldInfo` is used for any field definition regardless of whether the [`Field()`][pydantic.fields.Field]
    function is explicitly used.

    !!! warning
        You generally shouldn't be creating `FieldInfo` directly, you'll only need to use it when accessing
        [`BaseModel`][pydantic.main.BaseModel] `.model_fields` internals.

    Attributes:
        annotation: The type annotation of the field.
        default: The default value of the field.
        default_factory: The factory function used to construct the default for the field.
        alias: The alias name of the field.
        alias_priority: The priority of the field's alias.
        validation_alias: The validation alias name of the field.
        serialization_alias: The serialization alias name of the field.
        title: The title of the field.
        description: The description of the field.
        examples: List of examples of the field.
        exclude: Whether to exclude the field from the model serialization.
        discriminator: Field name for discriminating the type in a tagged union.
        json_schema_extra: Dictionary of extra JSON schema properties.
        frozen: Whether the field is frozen.
        validate_default: Whether to validate the default value of the field.
        repr: Whether to include the field in representation of the model.
        init_var: Whether the field should be included in the constructor of the dataclass.
        kw_only: Whether the field should be a keyword-only argument in the constructor of the dataclass.
        metadata: List of metadata constraints.
    r   r   r   rK   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r8   r9   r:   r;   r<   r=   r>   r?   r@   	list[Any]metadata)r   rK   r   r   r    r"   r#   r$   r%   r'   r)   r8   r:   r;   r<   r>   r?   r@   rN   _attributes_setN)r0   r+   r,   r-   r.   r/   r1   r2   r3   r4   r5   r6   r7   z7ClassVar[dict[str, typing.Callable[[Any], Any] | None]]metadata_lookupkwargsUnpack[_FieldInfoInputs]returnNonec                 K  s  dd |  D | _dd |  D }| |d\| _}|dt}|tu r,t| _n|| _|dd| _	| jturD| j	durDt
d|d	d| _|d
d| _|dd| _|dd| _tdd | j| j| jfD }|ry|ddpxdnd| _|dd| _|dd| _|dd| _|dd| _|dd| _|dd| _|dd| _|dd| _|dd| _|dd| _| || | _dS )a  This class should generally not be initialized directly; instead, use the `pydantic.fields.Field` function
        or one of the constructor classmethods.

        See the signature of `pydantic.fields.Field` for more details about the expected arguments.
        c                 S  s   i | ]\}}|t ur||qS rG   )r   .0kvrG   rG   rH   
<dictcomp>       z&FieldInfo.__init__.<locals>.<dictcomp>c                 S  s(   i | ]\}}||t u rt|n|qS rG   )r   _DefaultValuesgetrU   rG   rG   rH   rY      s   ( r   rK   r   N/cannot specify both default and default_factoryr$   r   r"   r#   c                 s  s    | ]}|d uV  qd S NrG   )rV   r   rG   rG   rH   	<genexpr>       z%FieldInfo.__init__.<locals>.<genexpr>r       r%   r'   r)   r8   r>   Tr:   r<   r;   r?   r@   )itemsrO   _extract_metadatar\   r   popr   EllipsisrK   r   	TypeErrorr$   r   r"   r#   anyr    r%   r'   r)   r8   r>   r:   r<   r;   r?   r@   _collect_metadatarN   )selfrQ   annotation_metadatarK   Zalias_is_setrG   rG   rH   __init__   s:    zFieldInfo.__init__Unpack[_FromFieldInfoInputs]typing_extensions.Selfc                 K  s"   d|v rt d| dd|i|S )a~  Create a new `FieldInfo` object with the `Field` function.

        Args:
            default: The default value for the field. Defaults to Undefined.
            **kwargs: Additional arguments dictionary.

        Raises:
            TypeError: If 'annotation' is passed as a keyword argument.

        Returns:
            A new FieldInfo object with the given parameters.

        Example:
            This is how you can create a field with default value like this:

            ```python
            import pydantic

            class MyModel(pydantic.BaseModel):
                foo: int = pydantic.Field(4)
            ```
        r   z9"annotation" is not permitted as a Field keyword argumentrK   NrG   )rf   )clsrK   rQ   rG   rG   rH   
from_field   s   zFieldInfo.from_field	type[Any]c           
      C  s   d}t |rd}|tjurt|d }t |rct|^}}t |r(d}dd |D }| j|d|i}|rct|}||_|pD|j	|_	g }|D ]}	t
|	tsW||	 qJ||	j qJ||_|S | ||phddS )	a  Creates a `FieldInfo` instance from a bare annotation.

        Args:
            annotation: An annotation object.

        Returns:
            An instance of the field metadata.

        Example:
            This is how you can create a field from a bare annotation like this:

            ```python
            import pydantic

            class MyModel(pydantic.BaseModel):
                foo: int  # <-- like this
            ```

            We also account for the case where the annotation can be an instance of `Annotated` and where
            one of the (not first) arguments in `Annotated` are an instance of `FieldInfo`, e.g.:

            ```python
            import annotated_types
            from typing_extensions import Annotated

            import pydantic

            class MyModel(pydantic.BaseModel):
                foo: Annotated[int, annotated_types.Gt(42)]
                bar: Annotated[int, pydantic.Field(gt=42)]
            ```

        FTr   c                 S     g | ]	}t |tr|qS rG   
isinstancerL   rV   arG   rG   rH   
<listcomp>      z-FieldInfo.from_annotation.<locals>.<listcomp>r   N)r   r;   )r   is_finalvartyping_extensionsFinalget_argsis_annotatedmerge_field_infosr   r   r;   rs   rL   appendextendrN   )
rn   r   final	first_arg
extra_argsZfield_info_annotations
field_infoZnew_field_inforN   ru   rG   rG   rH   from_annotation   s.   #




zFieldInfo.from_annotationc                   s  d}t |rd}|tjurt|d }t| rF |\|_}| j|7  _|j	g  fdd|D |R d|ji}|pB|j
|_
|S t|tjrd}|tju ratjdk r\tdd}t}nt|tjrld}|j} |} |\|_}| j|7  _|j	g  fd	d|D |R d|ji}|p|j
|_
||_t|d
d|_|S t |rt|^}}dd |D }	 j	|	||d}
g }|D ]}t|ts|| q||j q||
_|
S  |||pddS )a  Create `FieldInfo` from an annotation with a default value.

        Args:
            annotation: The type annotation of the field.
            default: The default value of the field.

        Returns:
            A field object with the passed values.

        Example:
            ```python
            import annotated_types
            from typing_extensions import Annotated

            import pydantic

            class MyModel(pydantic.BaseModel):
                foo: int = 4  # <-- like this
                bar: Annotated[int, annotated_types.Gt(4)] = 4  # <-- or this
                spam: Annotated[int, pydantic.Field(gt=4)] = 4  # <-- or this
            ```
        FTr   c                      g | ]	}t | r|qS rG   rs   rV   xrn   rG   rH   rv   O  rw   z6FieldInfo.from_annotated_attribute.<locals>.<listcomp>r   )      zBInitVar is not supported in Python 3.7 as type information is lostc                   r   rG   r   r   r   rG   rH   rv   b  rw   r@   Nc                 S  rq   rG   rr   rt   rG   rG   rH   rv   m  rw   )r   rK   )r   rK   r;   )r   rx   ry   rz   r{   rs   rc   r   rN   r}   r;   dataclassesr   InitVarsysversion_infoRuntimeErrorr   type_from_dataclass_fieldr?   getattrr@   r|   rL   r~   r   )rn   r   rK   r   rj   r?   Zpydantic_fieldr   r   field_infosr   rN   ru   rG   r   rH   from_annotated_attribute-  sj   







z"FieldInfo.from_annotated_attributer   	overridesc            	      O  s   g }| D ]}| dd |jD  || qt|} t| dkr>t| d }|j| | D ]
\}}t	||| q1|S i }i }| D ]}||j |jD ]}t
|ts\||t|< qOqD|| tdi |}t| |_|S )zMerge `FieldInfo` instances keeping only explicitly set attributes.

        Later `FieldInfo` instances override earlier ones.

        Returns:
            FieldInfo: A merged FieldInfo instance.
        c                 s  s    | ]
}t |tr|V  qd S r^   rr   r   rG   rG   rH   r_     s    z.FieldInfo.merge_field_infos.<locals>.<genexpr>r   r   NrG   )r   rN   r~   tuplelenr   rO   updaterb   setattrrs   rL   r   listvalues)	r   r   Zflattened_field_infosr   rW   rX   Z
new_kwargsrN   r   rG   rG   rH   r}   z  s0   	


zFieldInfo.merge_field_infosdc_fieldDataclassField[Any]c                 C  sX   |j }|tju r
t}|jtju rd}n|j}dd |j D }td|||jd|S )a]  Return a new `FieldInfo` instance from a `dataclasses.Field` instance.

        Args:
            dc_field: The `dataclasses.Field` instance to convert.

        Returns:
            The corresponding `FieldInfo` instance.

        Raises:
            TypeError: If any of the `FieldInfo` kwargs does not match the `dataclass.Field` kwargs.
        Nc                 S  s   i | ]\}}|t v r||qS rG   )_FIELD_ARG_NAMESrU   rG   rG   rH   rY     rZ   z3FieldInfo._from_dataclass_field.<locals>.<dictcomp>)rK   r   r>   rG   )	rK   r   MISSINGr   r   rN   rb   r   r>   )rn   r   rK   r   Zdc_field_metadatarG   rG   rH   r     s   
zFieldInfo._from_dataclass_field"tuple[type[Any] | None, list[Any]]c                 C  s4   |durt |rt|^}}|t|fS |g fS )a/  Tries to extract metadata/constraints from an annotation if it uses `Annotated`.

        Args:
            annotation: The type hint annotation for which metadata has to be extracted.

        Returns:
            A tuple containing the extracted metadata type and the list of extra arguments.
        N)r   r|   ry   r{   r   )rn   r   r   r   rG   rG   rH   rc     s
   

zFieldInfo._extract_metadatadict[str, Any]c              	   C  s   g }i }t | D ],\}}z| j| }W n	 ty   Y q
w ||= |dur6|du r/|||< q
||| q
|rD|tjdi | |S )a  Collect annotations from kwargs.

        The return type is actually `annotated_types.BaseMetadata | PydanticMetadata`,
        but it gets combined with `list[Any]` from `Annotated[T, ...]`, hence types.

        Args:
            kwargs: Keyword arguments passed to the function.

        Returns:
            A list of metadata objects - a combination of `annotated_types.BaseMetadata` and
                `PydanticMetadata`.
        NrG   )r   rb   rP   KeyErrorr~   r   ZPydanticGeneralMetadata)rn   rQ   rN   Zgeneral_metadatakeyvaluemarkerrG   rG   rH   rh     s"   
zFieldInfo._collect_metadataF)call_default_factoryr   c                C  s&   | j du rt| jS |r|   S dS )a  Get the default value.

        We expose an option for whether to call the default_factory (if present), as calling it may
        result in side effects that we want to avoid. However, there are times when it really should
        be called (namely, when instantiating a model via `model_construct`).

        Args:
            call_default_factory: Whether to call the default_factory or not. Defaults to `False`.

        Returns:
            The default value, calling the default factory if requested or `None` if not set.
        Nr   r   Zsmart_deepcopyrK   )ri   r   rG   rG   rH   get_default  s
   
zFieldInfo.get_defaultc                 C  s   | j tu o	| jdu S )zCheck if the argument is required.

        Returns:
            `True` if the argument is required, `False` otherwise.
        N)rK   r   r   ri   rG   rG   rH   is_required  s   zFieldInfo.is_requiredc                 C  s"   | j s| jS tj| jg| j R  S )a  Rebuilds the original annotation for use in function signatures.

        If metadata is present, it adds it to the original annotation using an
        `AnnotatedAlias`. Otherwise, it returns the original annotation as is.

        Returns:
            The rebuilt annotation.
        )rN   r   ry   	Annotatedr   rG   rG   rH   rebuild_annotation  s   	zFieldInfo.rebuild_annotationtypevars_mapdict[Any, Any] | Nonetypes_namespacedict[str, Any] | Nonec                 C  s"   t | j|d}t||| _dS )aZ  Apply a `typevars_map` to the annotation.

        This method is used when analyzing parametrized generic types to replace typevars with their concrete types.

        This method applies the `typevars_map` to the annotation in place.

        Args:
            typevars_map: A dictionary mapping type variables to their concrete types.
            types_namespace (dict | None): A dictionary containing related types to the annotated type.

        See Also:
            pydantic._internal._generics.replace_types is used for replacing the typevars with
                their concrete types.
        N)r   Zeval_type_lenientr   r   Zreplace_types)ri   r   r   r   rG   rG   rH   apply_typevars_map  s   zFieldInfo.apply_typevars_mapr   c                 c  s    dt t | jfV  d|  fV  | jD ]f}|dkrq|dkr#q|dkr+| js+q|dkr5| jdu r5q|dkr?| jdu r?q|d	krJ| j	| j
krJq|d
krU| j| j
krUq|dkrk| jd urkdt t | jfV  qt| |}|d ur}|tur}||fV  qd S )Nr   requiredrO   rN   r>   Tr;   Fr"   r#   r   )r   Z	PlainReprZdisplay_as_typer   r   	__slots__rN   r>   r;   r"   r   r#   r   r   r   )ri   sr   rG   rG   rH   __repr_args__$  s2   


zFieldInfo.__repr_args__)rQ   rR   rS   rT   )rK   r   rQ   rl   rS   rm   )r   rp   rS   rm   )r   rp   rK   r   rS   rm   )r   rL   r   r   rS   rL   )r   r   rS   rm   )r   r   rS   r   )rQ   r   rS   rM   )r   r=   rS   r   )rS   r=   rS   r   )r   r   r   r   rS   rT   )rS   r   )!rB   rC   rD   rE   rF   r   r   ZStrictannotated_typesGtZGeLtZLeZ
MultipleOfZMinLenZMaxLenrP   rk   classmethodr   ro   r   r   staticmethodr}   r   rc   rh   r   r   r   r   r   rG   rG   rG   rH   rL   K   sr   
 
)=L!


rL   c                   @  s.   e Zd ZU dZded< dd
dZdddZdS )	AliasPathzUsage docs: https://docs.pydantic.dev/2.2/usage/fields#aliaspath-and-aliaschoices

    A data class used by `validation_alias` as a convenience to create aliases.

    Attributes:
        path: A list of string or integer aliases.
    zlist[int | str]pathr   strargs	str | intrS   rT   c                 G     |gt | | _d S r^   )r   r   )ri   r   r   rG   rG   rH   rk   K     zAliasPath.__init__list[str | int]c                 C  s   | j S )zvConverts arguments to a list of string or integer aliases.

        Returns:
            The list of aliases.
        )r   r   rG   rG   rH   convert_to_aliasesN  s   zAliasPath.convert_to_aliasesN)r   r   r   r   rS   rT   )rS   r   rB   rC   rD   rE   rF   rk   r   rG   rG   rG   rH   r   ?  
   
 
r   c                   @  s.   e Zd ZU dZded< ddd	ZdddZdS )AliasChoiceszUsage docs: https://docs.pydantic.dev/2.2/usage/fields#aliaspath-and-aliaschoices

    A data class used by `validation_alias` as a convenience to create aliases.

    Attributes:
        choices: A list containing a string or `AliasPath`.
    zlist[str | AliasPath]choicesfirst_choicestr | AliasPathrS   rT   c                 G  r   r^   )r   r   )ri   r   r   rG   rG   rH   rk   c  r   zAliasChoices.__init__list[list[str | int]]c                 C  s:   g }| j D ]}t|tr||  q||g q|S )zConverts arguments to a list of lists containing string or integer aliases.

        Returns:
            The list of aliases.
        )r   rs   r   r~   r   )ri   aliasescrG   rG   rH   r   f  s   

zAliasChoices.convert_to_aliasesN)r   r   r   r   rS   rT   )rS   r   r   rG   rG   rG   rH   r   W  r   r   c                   @  s   e Zd ZdZdS )_EmptyKwargsz_This class exists solely to ensure that type checking warns about passing `**extra` in `Field`.N)rB   rC   rD   rE   rG   rG   rG   rH   r   u  s    r   rK   .r   r   r    r"   r#   r$   r%   r'   r)   r8   r:   r;   r<   r>   Tr?   r@   r3   r0   r+   r,   r-   r.   r/   r4   r5   r6   r1   r2   )r   r   r    r"   r#   r$   r%   r'   r)   r8   r:   r;   r<   r>   r?   r@   r3   r0   r+   r,   r-   r.   r/   r4   r5   r6   r1   r2   r7   r   r   r   r!   r&   r(   r9   r=   r*   r7   !Literal['smart', 'left_to_right']extraUnpack[_EmptyKwargs]rS   c          &      K  sH  | dd}|durtddd| dd} | dur'tdt |dtfv r'| }| dd}!|!dur>td	t |dtfv r>|!}| d
d}"|"durNtddd| dd}#|#durctdt |#du rcd}| dd}$|$durstddd|rtdddd | D  dt |r|tu r|}|r|turt|tt	t
fstd|tdfv rt|tr|}|tdfv r|}| dd}%|%durtdt tj| fi d|d|d|d|d|d|d |d!|d"|	d#|
d$|d%|d&|d'|d(|d)|d*|d+|d,|d-|d.|d/|d0|d1|d2|d3|d4|d5|d6|S )7aV  Usage docs: https://docs.pydantic.dev/2.2/usage/fields

    Create a field for objects that can be configured.

    Used to provide extra information about a field, either for the model schema or complex validation. Some arguments
    apply only to number fields (`int`, `float`, `Decimal`) and some apply only to `str`.

    Note:
        - Any `_Unset` objects will be replaced by the corresponding value defined in the `_DefaultValues` dictionary. If a key for the `_Unset` object is not found in the `_DefaultValues` dictionary, it will default to `None`

    Args:
        default: Default value if the field is not set.
        default_factory: A callable to generate the default value, such as :func:`~datetime.utcnow`.
        alias: An alternative name for the attribute.
        alias_priority: Priority of the alias. This affects whether an alias generator is used.
        validation_alias: 'Whitelist' validation step. The field will be the single one allowed by the alias or set of
            aliases defined.
        serialization_alias: 'Blacklist' validation step. The vanilla field will be the single one of the alias' or set
            of aliases' fields and all the other fields will be ignored at serialization time.
        title: Human-readable title.
        description: Human-readable description.
        examples: Example values for this field.
        exclude: Whether to exclude the field from the model serialization.
        discriminator: Field name for discriminating the type in a tagged union.
        json_schema_extra: Any additional JSON schema data for the schema property.
        frozen: Whether the field is frozen.
        validate_default: Run validation that isn't only checking existence of defaults. This can be set to `True` or `False`. If not set, it defaults to `None`.
        repr: A boolean indicating whether to include the field in the `__repr__` output.
        init_var: Whether the field should be included in the constructor of the dataclass.
        kw_only: Whether the field should be a keyword-only argument in the constructor of the dataclass.
        strict: If `True`, strict validation is applied to the field.
            See [Strict Mode](../usage/strict_mode.md) for details.
        gt: Greater than. If set, value must be greater than this. Only applicable to numbers.
        ge: Greater than or equal. If set, value must be greater than or equal to this. Only applicable to numbers.
        lt: Less than. If set, value must be less than this. Only applicable to numbers.
        le: Less than or equal. If set, value must be less than or equal to this. Only applicable to numbers.
        multiple_of: Value must be a multiple of this. Only applicable to numbers.
        min_length: Minimum length for strings.
        max_length: Maximum length for strings.
        pattern: Pattern for strings.
        allow_inf_nan: Allow `inf`, `-inf`, `nan`. Only applicable to numbers.
        max_digits: Maximum number of allow digits for strings.
        decimal_places: Maximum number of decimal places allowed for numbers.
        union_mode: The strategy to apply when validating a union. Can be `smart` (the default), or `left_to_right`.
            See [Union Mode](../usage/types/unions.md#union-mode) for details.
        extra: Include extra fields used by the JSON schema.

            !!! warning Deprecated
                The `extra` kwargs is deprecated. Use `json_schema_extra` instead.

    Returns:
        A new [`FieldInfo`][pydantic.fields.FieldInfo], the return annotation is `Any` so `Field` can be used on
            type annotated fields without causing a typing error.
    constNz)`const` is removed, use `Literal` insteadzremoved-kwargs)code	min_itemszG`min_items` is deprecated and will be removed, use `min_length` instead	max_itemszG`max_items` is deprecated and will be removed, use `max_length` insteadunique_itemsz`unique_items` is removed, use `Set` instead(this feature is discussed in https://github.com/pydantic/pydantic-core/issues/296)allow_mutationzH`allow_mutation` is deprecated and will be removed. use `frozen` insteadFTregexz)`regex` is removed. use `pattern` insteadzzUsing extra keyword arguments on `Field` is deprecated and will be removed. Use `json_schema_extra` instead. (Extra keys: z, c                 s  s    | ]}|  V  qd S r^   )__repr__)rV   rW   rG   rG   rH   r_     r`   zField.<locals>.<genexpr>)zSInvalid `validation_alias` type. it should be `str`, `AliasChoices`, or `AliasPath`includezS`include` is deprecated and does nothing. It will be removed, use `exclude` insteadr   r   r    r"   r#   r$   r%   r'   r)   r8   r:   r;   r3   r<   r>   r?   r@   r0   r+   r,   r-   r.   r/   r1   r2   r4   r5   r6   r7   )rd   r   r   DeprecationWarningr   joinkeysrs   r   r   r   rf   rL   ro   )&rK   r   r   r    r"   r#   r$   r%   r'   r)   r8   r:   r;   r<   r>   r?   r@   r3   r0   r+   r,   r-   r.   r/   r4   r5   r6   r1   r2   r7   r   r   r   r   r   r   r   r   rG   rG   rH   r     s   Y



	
r   c                   @  sV   e Zd ZdZdZefdddddZejsdddZ	dddZ
dddZd ddZdS )!ModelPrivateAttra  A descriptor for private attributes in class models.

    Attributes:
        default: The default value of the attribute if not provided.
        default_factory: A callable function that generates the default value of the
            attribute if not provided.
    rK   r   Nr   rK   r   r   r   rS   rT   c                C  s   || _ || _d S r^   r   )ri   rK   r   rG   rG   rH   rk   c  s   
zModelPrivateAttr.__init__itemr   c                 C  s8   |dv rt | j|rt| j|S tt| jd|)zThis function improves compatibility with custom descriptors by ensuring delegation happens
            as expected when the default value of a private attribute is a descriptor.
            >   __set____get__
__delete__z object has no attribute )hasattrrK   r   AttributeErrorr   rB   )ri   r   rG   rG   rH   __getattr__l  s   zModelPrivateAttr.__getattr__rn   rp   namec                 C  s@   | j tu rdS t| j dsdS | j j}t|r||| dS dS )zMPreserve `__set_name__` protocol defined in https://peps.python.org/pep-0487.N__set_name__)rK   r   r   r   callable)ri   rn   r   set_namerG   rG   rH   r   u  s   
zModelPrivateAttr.__set_name__c                 C  s   | j du rt| jS |   S )aU  Retrieve the default value of the object.

        If `self.default_factory` is `None`, the method will return a deep copy of the `self.default` object.

        If `self.default_factory` is not `None`, it will call `self.default_factory` and return the value returned.

        Returns:
            The default value of the object.
        Nr   r   rG   rG   rH   r     s   
zModelPrivateAttr.get_defaultotherr=   c                 C  s$   t || jo| j| jf|j|jfkS r^   )rs   	__class__rK   r   )ri   r   rG   rG   rH   __eq__  s   zModelPrivateAttr.__eq__)rK   r   r   r   rS   rT   )r   r   rS   r   )rn   rp   r   r   rS   rT   r   )r   r   rS   r=   )rB   rC   rD   rE   r   r   rk   typingTYPE_CHECKINGr   r   r   r   rG   rG   rG   rH   r   X  s    

	

r   r   c                C  s$   | t ur|durtdt| |dS )a  Indicates that attribute is only used internally and never mixed with regular fields.

    Private attributes are not checked by Pydantic, so it's up to you to maintain their accuracy.

    Private attributes are stored in `__private_attributes__` on the model.

    Args:
        default: The attribute's default value. Defaults to Undefined.
        default_factory: Callable that will be
            called when a default value is needed for this attribute.
            If both `default` and `default_factory` are set, an error will be raised.

    Returns:
        An instance of [`ModelPrivateAttr`][pydantic.fields.ModelPrivateAttr] class.

    Raises:
        ValueError: If both `default` and `default_factory` are set.
    Nr]   r   )r   rf   r   r   rG   rG   rH   PrivateAttr  s   r   c                   @  sV   e Zd ZU dZdZded< ded< ded< d	ed
< ded< d	ed< d	ed< ded< dS )ComputedFieldInfoa+  A container for data from `@computed_field` so that we can access it while building the pydantic-core schema.

    Attributes:
        decorator_repr: A class variable representing the decorator string, '@computed_field'.
        wrapped_property: The wrapped computed field property.
        return_type: The type of the computed field property's return value.
        alias: The alias of the property to be used during encoding and decoding.
        alias_priority: priority of the alias. This affects whether an alias generator is used
        title: Title of the computed field as in OpenAPI document, should be a short summary.
        description: Description of the computed field as in OpenAPI document.
        repr: A boolean indicating whether or not to include the field in the __repr__ output.
    z@computed_fieldzClassVar[str]decorator_reprpropertyZwrapped_propertyr   return_typer   r   r   r    r$   r%   r=   r>   N)rB   rC   rD   rE   r   rF   rG   rG   rG   rH   r     s   
 r   	PropertyTr   r   r    r$   r%   r>   r   'typing.Callable[[PropertyT], PropertyT]c                 C     d S r^   rG   r   rG   rG   rH   computed_field  s   
r   __funcc                 C  r   r^   rG   )r   rG   rG   rH   r     s   )r   r    r$   r%   r>   r   __fPropertyT | None3PropertyT | typing.Callable[[PropertyT], PropertyT]c                  s,   d fdd}| du r|S || S )a  Usage docs: https://docs.pydantic.dev/2.2/usage/computed_fields/

    Decorator to include `property` and `cached_property` when serializing models.

    If applied to functions not yet decorated with `@property` or `@cached_property`, the function is
    automatically wrapped with `property`.

    Args:
        __f: the function to wrap.
        alias: alias to use when serializing this computed field, only used when `by_alias=True`
        alias_priority: priority of the alias. This affects whether an alias generator is used
        title: Title to used when including this computed field in JSON Schema, currently unused waiting for #4697
        description: Description to used when including this computed field in JSON Schema, defaults to the functions
            docstring, currently unused waiting for #4697
        repr: whether to include this computed field in model repr
        return_type: optional return for serialization logic to expect when serializing to JSON, if included
            this must be correct, otherwise a `TypeError` is raised.
            If you don't include a return type Any is used, which does runtime introspection to handle arbitrary
            objects.

    Returns:
        A proxy wrapper for the property.
    fr   rS   c                   sb   t | }d u r|jrt|jt | }  d urpdnd t|  }t | |S )Nra   )r   Zunwrap_wrapped_functionrE   inspectcleandocZensure_propertyr   ZPydanticDescriptorProxy)r  Z	unwrappedZdec_infor   r    r%   r>   r   r$   rG   rH   dec  s   

 zcomputed_field.<locals>.decN)r  r   rS   r   rG   )r   r   r    r$   r%   r>   r   r  rG   r  rH   r     s   "rG   )@rK   r   r   r   r   r   r    r   r"   r!   r#   r   r$   r   r%   r   r'   r&   r)   r(   r8   r   r:   r9   r;   r(   r<   r(   r>   r=   r?   r(   r@   r(   r3   r   r0   r(   r+   r*   r,   r*   r-   r*   r.   r*   r/   r*   r4   r(   r5   r   r6   r   r1   r   r2   r   r7   r   r   r   rS   r   )rK   r   r   r   rS   r   )r   r   r   r   r    r   r$   r   r%   r   r>   r=   rS   r   )r   r   rS   r   r^   )r   r   r   r   r    r   r$   r   r%   r   r>   r=   r   r   rS   r   )@rE   
__future__r   Z_annotationsr   r  r   r   r   r   ZDataclassFieldr   r   warningsr   r   ry   Zpydantic_corer   r	   r
    r   	_internalr   r   r   r   r   r   r   errorsr   r   r   Z_internal._reprr   r   r   rF   	TypedDictr   rJ   ZRepresentationrL   	dataclassZ
slots_truer   r   r   dictr[   set	signature
parametersr   remover   r   r   TypeVarr   overloadr   rG   rG   rG   rH   <module>   s4   $#   w	
" ;
; 
