
    5jF"                       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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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'  SSK(J)r)  \RT                  (       a8  SSK+J,r,  SSK-J.r.   " S S\R^                  5      r0 " S S\0\R^                  5      r1O\r2  S       S S jjr3SS.         S!S jjr4S"S jr5g)#z0Private logic for creating pydantic dataclasses.    )annotationsN)partialwraps)AnyCallableClassVar)
ArgsKwargsSchemaSerializerSchemaValidatorcore_schema)	TypeGuard   )PydanticUndefinedAnnotation)PluggableSchemaValidatorcreate_schema_validator)PydanticDeprecatedSince20   )_config_decorators_typing_extra)collect_dataclass_fields)GenerateSchema)get_standard_typevars_map)set_dataclass_mocks)CallbackGetCoreSchemaHandler)generate_pydantic_signature)
ConfigDict)	FieldInfoc                  >    \ rS rSr% S\S'   S\S'   S\S'   SS jrS	rg
)StandardDataclass"   zClassVar[dict[str, Any]]__dataclass_fields__zClassVar[Any]__dataclass_params__zClassVar[Callable[..., None]]__post_init__c                    g N )selfargskwargss      ^/root/lseg-credit/backend/venv/lib/python3.13/site-packages/pydantic/_internal/_dataclasses.py__init__StandardDataclass.__init__'   s        r'   N)r)   objectr*   r/   returnNone)__name__
__module____qualname____firstlineno____annotations__r,   __static_attributes__r'   r.   r+   r    r    "   s    66++44	r.   r    c                  `    \ 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__r'   N)r2   r3   r4   r5   __doc__r6   r7   r'   r.   r+   r9   r9   *   s3    
	 21--"BB!EE;;!;; TTr.   r9   c                :    [        U 5      n[        XX2S9nX@l        g)zCollect and set `cls.__pydantic_fields__`.

Args:
    cls: The class.
    types_namespace: The types namespace, defaults to `None`.
    config_wrapper: The config wrapper instance, defaults to `None`.
)typevars_mapconfig_wrapperN)r   r   r?   )clstypes_namespacerE   rD   fieldss        r+   set_dataclass_fieldsrI   E   s      -S1L%cuF$r.   T)raise_errorsc          
       ^ [        U S5      (       a  [        R                  " S[        5        Uc  [        R
                  " U 5      n[        XUS9  [        U 5      n[        UUU5      n[        U R                  U R                  USS9nSS jnU R                   S3Ul        Xpl
        UR                  U l        X`l        [!        U S	S5      n U(       a%  U" U [#        [%        UR&                  S
S9USS95      n	OUR'                  U S
S9n	 UR1                  U 5      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! [(         a6  n
U(       a  e [+        X R,                  SU
R.                   S35         Sn
A
g
Sn
A
ff = f! UR4                   a    [+        X R,                  S5         g
f = f)ag  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`.
    types_namespace: The types namespace.

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.
__post_init_post_parse__zVSupport for `__post_init_post_parse__` has been dropped, the method will not be calledN)rE   T)initrH   rE   is_dataclassc                R    SnU nUR                   R                  [        X5      US9  g )NT)self_instance)rA   validate_pythonr	   )__dataclass_self__r)   r*   __tracebackhide__ss        r+   r,   $complete_dataclass.<locals>.__init__   s,     	  00D1IYZ0[r.   z	.__init____get_pydantic_core_schema__F)from_dunder_get_core_schemaunpack)ref_mode`zall referenced typesztype[PydanticDataclass]	dataclassc               *   > TR                  XU5        g r&   )validate_assignment)instancefieldvalue	validators      r+   validated_setattr-complete_dataclass.<locals>.validated_setattr   s    ))(5Ar.   )rR   r9   r)   r   r*   r   r0   r1   )r^   r   r_   strr`   rd   r0   r1   ))hasattrwarningswarnDeprecationWarningr   merge_cls_and_parent_nsrI   r   r   r   r,   r?   r4   config_dictr;   __signature__getattrr   r   generate_schemar   r   r2   namecore_configclean_schemaCollectedInvalidtypingcastr=   r   r3   plugin_settingsrA   r
   r@   r]   r   __setattr____get__r<   )rF   rE   rJ   rG   rD   
gen_schemasigr,   get_core_schemaschemaero   rb   ra   s                @r+   complete_dataclassr|   W   s=   2 s.//dfx	
 '??DnM,S1LJ &\\&&%	C\
  #//0	:HL,88Cc#A4HO$,J66TYZ%F  //QV/WF !,,S1K((0 ++/
5C $* -DS^^S%5%5{KQoQo. C #36"GC))	s		B 
 	B ,33D#> $CE ' C166(!}=	 && C/EFs0   +G 9G H! 
H(,HH!&I
	I
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.
```py
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.
rA   r6   )dataclassesrN   re   setr"   
issupersetrl   )_clss    r+   is_builtin_dataclassr      sZ    > 	  & 	a677	a))*55c'$HY[]:^6_`r.   )NN)rF   ztype[StandardDataclass]rG   dict[str, Any] | NonerE   z_config.ConfigWrapper | Noner0   r1   )
rF   	type[Any]rE   z_config.ConfigWrapperrJ   boolrG   r   r0   r   )r   r   r0   z"TypeGuard[type[StandardDataclass]])6rB   
__future__r   _annotationsr~   rr   rf   	functoolsr   r   r   r   r   pydantic_corer	   r
   r   r   typing_extensionsr   errorsr   plugin._schema_validatorr   r   r    r   r   r   _fieldsr   _generate_schemar   	_genericsr   _mock_val_serr   _schema_generation_sharedr   
_signaturer   TYPE_CHECKINGconfigr   rH   r   Protocolr    r9   rh   rI   r|   r   r'   r.   r+   <module>r      s    6 2    $ * *  ( 0 X 0 1 1 - , 0 . C 3	#"FOO U-v U0 3
 .237%	 %*% 1% 
	%, 	l	l)l 	l
 +l 
l^"r.   