
    .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                  t    \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   S\S'   \SS j5       r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__c                    g N )clss    W/var/www/auris/envauris/lib/python3.13/site-packages/pydantic/_internal/_dataclasses.py__pydantic_fields_complete__.PydanticDataclass.__pydantic_fields_complete__:   s    7:    r,   N)returnbool)	__name__
__module____qualname____firstlineno____doc____annotations__classmethodr/   __static_attributes__r,   r1   r.   r!   r!   %   sA    
	 21--"BB!EE;;!;; TT	: 
:r1   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'   )r-   r=   r?   r>   fieldss        r.   set_dataclass_fieldsrA   C   s%     -S1L%<F %r1   TF)raise_errorsr=   _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        r.   __init__$complete_dataclass.<locals>.__init__x   s,     	  00D1IYZ0[r1   z	.__init__)r?   F__post_init_post_parse__zVSupport for `__post_init_post_parse__` has been dropped, the method will not be called)r=   r>   __signature__T)initr@   validate_by_nameextrais_dataclass`N)titlez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Ar1   )rH   r!   rI   r   rJ   r   r2   None)rZ   r   r[   strr\   ra   r2   r`   ))rM   r6   config_dictr#   rA   defer_buildr   hasattrwarningswarnDeprecationWarningr   r   r   r   r   r'   rR   rS   rP   generate_schemar   namecore_configr4   clean_schemar   typingcastr%   r   r5   plugin_settingsr)   r	   r(   rY   r   __setattr____get__r$   )r-   r?   rB   r=   rC   original_initrM   r>   
gen_schemaschemaerj   r^   r]   s                @r.   complete_dataclassru   W   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)   r9   )dataclassesrT   rd   set__dataclass_fields__
issupersetgetattr)_clss    r.   is_builtin_dataclassr}      sZ    > 	  & 	a677	a))*55c'$HY[]:^6_`r1   )NN)r-   ztype[StandardDataclass]r=   NsResolver | Noner?   z_config.ConfigWrapper | Noner2   r`   )r-   	type[Any]r?   z_config.ConfigWrapperrB   r3   r=   r~   rC   r3   r2   r3   )r|   r   r2   z"TypeGuard[type[StandardDataclass]])9r8   
__future__r   _annotationsrw   rl   re   	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   r@   r   Protocolr!   rg   rA   ru   r}   r,   r1   r.   <module>r      s    6 2    $    ( 0 X 0 " - @ 0 . ( 3 &	@#";-v ;6 3
 &*37%	 %"% 1% 
	%0 %)r	r)r 	r
 #r r 
rj"r1   