
    h"                       S r SSKJr  SSKrSSKrSSKrSSKJrJ	r	  SSKJ
r
Jr  SSKJrJrJrJr  SSKJr  SS	KJr  SS
KJrJr  SSKJr  SSKJrJr  SSKJr  SSKJrJ r   SSK!J"r"  SSK#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  \RV                  (       a)  SSK,J-r.  SSK/J0r0  SSK1J2r2   " S S\.\Rf                  5      r4O\r5  S        S!S jjr6SSSS.           S"S jjr7S#S jr8g)$z0Private logic for creating pydantic dataclasses.    )annotationsN)partialwraps)AnyClassVar)
ArgsKwargsSchemaSerializerSchemaValidatorcore_schema)	TypeGuard   )PydanticUndefinedAnnotation)PluggableSchemaValidatorcreate_schema_validator)PydanticDeprecatedSince20   )_config_decorators)collect_dataclass_fields)GenerateSchemaInvalidSchemaError)get_standard_typevars_map)set_dataclass_mocks)
NsResolver)generate_pydantic_signature)LazyClassAttribute)DataclassInstance)
ConfigDict)	FieldInfoc                  `    \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   S\S'   Srg)PydanticDataclass%   a!  A protocol containing attributes only available once a class has been decorated as a Pydantic dataclass.

Attributes:
    __pydantic_config__: Pydantic-specific configuration settings for the dataclass.
    __pydantic_complete__: Whether dataclass building is completed, or if there are still undefined fields.
    __pydantic_core_schema__: The pydantic-core schema used to build the SchemaValidator and SchemaSerializer.
    __pydantic_decorators__: Metadata containing the decorators defined on the dataclass.
    __pydantic_fields__: Metadata about the fields defined on the dataclass.
    __pydantic_serializer__: The pydantic-core SchemaSerializer used to dump instances of the dataclass.
    __pydantic_validator__: The pydantic-core SchemaValidator used to validate instances of the dataclass.
zClassVar[ConfigDict]__pydantic_config__zClassVar[bool]__pydantic_complete__z ClassVar[core_schema.CoreSchema]__pydantic_core_schema__z$ClassVar[_decorators.DecoratorInfos]__pydantic_decorators__zClassVar[dict[str, FieldInfo]]__pydantic_fields__zClassVar[SchemaSerializer]__pydantic_serializer__z4ClassVar[SchemaValidator | PluggableSchemaValidator]__pydantic_validator__ N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r*       Q/var/www/html/env/lib/python3.13/site-packages/pydantic/_internal/_dataclasses.pyr!   r!   %   s3    
	 21--"BB!EE;;!;; TTr2   r!   c                :    [        U 5      n[        XX2S9nX@l        g)zCollect and set `cls.__pydantic_fields__`.

Args:
    cls: The class.
    ns_resolver: Namespace resolver to use when getting dataclass annotations.
    config_wrapper: The config wrapper instance, defaults to `None`.
)ns_resolvertypevars_mapconfig_wrapperN)r   r   r'   )clsr5   r7   r6   fieldss        r3   set_dataclass_fieldsr:   @   s%     -S1L%<F %r2   TF)raise_errorsr5   _force_buildc               ^  ^ U R                   nSS jnU R                   S3Ul        X`l         UR                  U l        [	        XUS9  U(       d  UR
                  (       a  [        U 5        g[        U S5      (       a  [        R                  " S[        5        [        U 5      n[        UUUS9n[        S[        [        UU R                   UR"                  UR$                  S	S
95      U l         UR)                  U 5      n	UR/                  U R0                  S9n UR3                  U	5      n	[6        R8                  " SU 5      n Xl        [=        XU R>                  U R                  SXR@                  5      =U l!        m[E        X5      U l#        URH                  (       a7  [K        U RL                  5      SU4S jj5       nURO                  SU 5      U l&        S	U l(        g	! [*         a,  n
U(       a  e [        U SU
R,                   S35         Sn
A
gSn
A
ff = f! [4         a    [        U 5         gf = f)aJ  Finish building a pydantic dataclass.

This logic is called on a class which has already been wrapped in `dataclasses.dataclass()`.

This is somewhat analogous to `pydantic._internal._model_construction.complete_model_class`.

Args:
    cls: The class.
    config_wrapper: The config wrapper instance.
    raise_errors: Whether to raise errors, defaults to `True`.
    ns_resolver: The namespace resolver instance to use when collecting dataclass fields
        and during schema building.
    _force_build: Whether to force building the dataclass, no matter if
        [`defer_build`][pydantic.config.ConfigDict.defer_build] is set.

Returns:
    `True` if building a pydantic dataclass is successfully completed, `False` otherwise.

Raises:
    PydanticUndefinedAnnotation: If `raise_error` is `True` and there is an undefined annotations.
c                R    SnU nUR                   R                  [        X5      US9  g )NT)self_instance)r)   validate_pythonr   )__dataclass_self__argskwargs__tracebackhide__ss        r3   __init__$complete_dataclass.<locals>.__init__u   s,     	  00D1IYZ0[r2   z	.__init__)r7   F__post_init_post_parse__zVSupport for `__post_init_post_parse__` has been dropped, the method will not be called)r5   r6   __signature__T)initr9   validate_by_nameextrais_dataclass`N)titleztype[PydanticDataclass]	dataclassc               *   > TR                  XU5        g )N)validate_assignment)instancefieldvalue	validators      r3   validated_setattr-complete_dataclass.<locals>.validated_setattr   s    ))(5Ar2   )rA   r!   rB   r   rC   r   returnNone)rS   r   rT   strrU   r[   rY   rZ   ))rF   r-   config_dictr#   r:   defer_buildr   hasattrwarningswarnDeprecationWarningr   r   r   r   r   r'   rK   rL   rI   generate_schemar   namecore_configr+   clean_schemar   typingcastr%   r   r,   plugin_settingsr)   r	   r(   rR   r   __setattr____get__r$   )r8   r7   r;   r5   r<   original_initrF   r6   
gen_schemaschemaerd   rW   rV   s                @r3   complete_dataclassro   T   s   : LLM\
  #//0	:HL,88C.IN66C s.//dfx	
 -S1L!J +' **+<< &&		
C++C0 !,,3<<,@K((0 ++/
5C $* -DS^^S%5%5{KQoQo. C #36"GC))	s		B 
 	B ,33D#> $CE ' C1QVVHA/	  C s*   .G H 
H%"HHH,+H,c           	         [         R                  " U 5      =(       aP    [        U S5      (       + =(       a8    [        U R                  5      R                  [        [        U S0 5      5      5      $ )a  Returns True if a class is a stdlib dataclass and *not* a pydantic dataclass.

We check that
- `_cls` is a dataclass
- `_cls` does not inherit from a processed pydantic dataclass (and thus have a `__pydantic_validator__`)
- `_cls` does not have any annotations that are not dataclass fields
e.g.
```python
import dataclasses

import pydantic.dataclasses

@dataclasses.dataclass
class A:
    x: int

@pydantic.dataclasses.dataclass
class B(A):
    y: int
```
In this case, when we first check `B`, we make an extra check and look at the annotations ('y'),
which won't be a superset of all the dataclass fields (only the stdlib fields i.e. 'x')

Args:
    cls: The class.

Returns:
    `True` if the class is a stdlib dataclass, `False` otherwise.
r)   r0   )dataclassesrM   r^   set__dataclass_fields__
issupersetgetattr)_clss    r3   is_builtin_dataclassrw      sZ    > 	  & 	a677	a))*55c'$HY[]:^6_`r2   )NN)r8   ztype[StandardDataclass]r5   NsResolver | Noner7   z_config.ConfigWrapper | NonerY   rZ   )r8   	type[Any]r7   z_config.ConfigWrapperr;   boolr5   rx   r<   rz   rY   rz   )rv   ry   rY   z"TypeGuard[type[StandardDataclass]])9r/   
__future__r   _annotationsrq   rf   r_   	functoolsr   r   r   r   pydantic_corer   r	   r
   r   typing_extensionsr   errorsr   plugin._schema_validatorr   r   r    r   r   _fieldsr   _generate_schemar   r   	_genericsr   _mock_val_serr   _namespace_utilsr   
_signaturer   _utilsr   TYPE_CHECKING	_typeshedr   StandardDataclassconfigr   r9   r   Protocolr!   ra   r:   ro   rw   r*   r2   r3   <module>r      s    6 2    $    ( 0 X 0 " - @ 0 . ( 3 &	@#"U-v U0 3
 &*37%	 %"% 1% 
	%0 %)r	r)r 	r
 #r r 
rj"r2   