Ë
    &V.j%  ã                  óÂ  — d Z ddlmZ ddlZddlZddlZddlmZm	Z	 ddlm
Z
mZ ddlmZmZmZm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mZmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ejX                  r)ddl-m.Z/ ddl0m1Z1 ddl2m3Z3  G d„ de/ejh                  «      Z5neZ6	 	 d!	 	 	 	 	 	 	 d"d„Z7ddddœ	 	 	 	 	 	 	 	 	 	 	 d#d„Z8d$d „Z9y)%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)Úget_standard_typevars_map)Úset_dataclass_mocks)Ú
NsResolver)ÚCallbackGetCoreSchemaHandler)Úgenerate_pydantic_signature)ÚLazyClassAttribute)ÚDataclassInstance)Ú
ConfigDict)Ú	FieldInfoc                  óX   — 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<   y)ÚPydanticDataclassai  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__Ú__doc__Ú__annotations__© ó    úaC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\pydantic/_internal/_dataclasses.pyr!   r!   &   s3   … ñ
	ð 2Ó1Ø-Ó-Ø"BÓBØ!EÓEØ;Ó;Ø!;Ó;Ø TÔTr/   r!   c                óF   — t        | «      }t        | |||¬«      }|| _        y)zîCollect 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&   )Úclsr2   r4   r3   Úfieldss        r0   Úset_dataclass_fieldsr7   A   s,   € ô -¨SÓ1€LÜ%Ø˜°<ÐP^ô€Fð %€CÕr/   TF)Úraise_errorsr2   Ú_force_buildc               ó
  ‡— | j                   }dd„}| j                  › d�|_        || _         |j                  | _        t	        | ||¬«       |s#|j
                  rt        | | j                  «       yt        | d«      rt        j                  dt        «       t        | «      }t        |||¬«      }t        dt        t         || j"                  |j$                  |j&                  d	¬
«      «      | _        t+        | dd«      }		 |	r+ |	| t-        t        |j.                  d¬«      |d¬«      «      }
n|j/                  | d¬«      }
|j5                  | j                  ¬«      }	 |j7                  |
«      }
t;        j<                  d| «      } |
| _        tA        |
| | jB                  | j                  d||jD                  «      x| _#        ŠtI        |
|«      | _%        |jL                  r5tO        | jP                  «      dˆfd„«       }|jS                  d| «      | _(        d	| _*        y	# t0        $ r2}|r‚ t        | | j                  d|j2                  › d�«       Y d}~yd}~ww xY w# |j8                  $ r t        | | j                  d«       Y yw xY w)a†  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                óZ   — d}| }|j                   j                  t        ||«      |¬«       y )NT)Úself_instance)r(   Úvalidate_pythonr   )Ú__dataclass_self__ÚargsÚkwargsÚ__tracebackhide__Úss        r0   Ú__init__z$complete_dataclass.<locals>.__init__v   s.   € Ø ÐØˆØ	× Ñ ×0Ñ0´¸DÀ&Ó1IÐYZÐ0Õ[r/   z	.__init__)r4   FÚ__post_init_post_parse__zVSupport for `__post_init_post_parse__` has been dropped, the method will not be called)r2   r3   Ú__signature__T)Úinitr6   Úpopulate_by_nameÚextraÚis_dataclassÚ__get_pydantic_core_schema__N)Úfrom_dunder_get_core_schemaÚunpack)Úref_modeÚ`)Útitlezall referenced typesztype[PydanticDataclass]Ú	dataclassc               ó,   •— ‰j                  | ||«       y )N)Úvalidate_assignment)ÚinstanceÚfieldÚvalueÚ	validators      €r0   Úvalidated_setattrz-complete_dataclass.<locals>.validated_setattrÊ   s   ø€ à×)Ñ)¨(°E¸5ÕAr/   )r>   r!   r?   r   r@   r   ÚreturnÚNone)rS   r   rT   ÚstrrU   rZ   rX   rY   )+rC   r+   Úconfig_dictr"   r7   Údefer_buildr   r)   ÚhasattrÚwarningsÚwarnÚDeprecationWarningr   r   r   r   r   r&   rG   rH   rE   Úgetattrr   Úgenerate_schemar   ÚnameÚcore_configÚclean_schemaÚCollectedInvalidÚtypingÚcastr$   r   r*   Úplugin_settingsr(   r	   r'   rR   r   Ú__setattr__Ú__get__r#   )r5   r4   r8   r2   r9   Úoriginal_initrC   r3   Ú
gen_schemaÚget_core_schemaÚschemaÚerd   rW   rV   s                 @r0   Úcomplete_dataclassrq   U   s{  ø€ ð: —L‘L€Mó\ð
  #×/Ñ/Ð0°	Ð:€HÔà€C„LØ,×8Ñ8€CÔä˜˜k¸.ÕIá˜N×6Ò6Ü˜C §¡Ô.ØäˆsÐ.Ô/Ü�‰ØdÔfxô	
ô -¨SÓ1€LÜØØØ!ô€Jô +ØÜÜ'ð Ø×*Ñ*Ø+×<Ñ<Ø ×&Ñ&Øô		
ó€CÔô ˜cÐ#AÀ4ÓH€OðÙÙ$ØÜ,Ü˜J×6Ñ6ÐTYÔZØØ%ôó‰Fð  ×/Ñ/°ÐQVÐ/ÓWˆFð !×,Ñ,°3·<±<Ð,Ó@€KðØ×(Ñ(¨Ó0ˆô �+‰+Ð/°Ó
5€Cð $*€CÔ Ü-DØ��S—^‘^ S×%5Ñ%5°{ÀKÐQ_×QoÑQoó.ð €CÔ ô #3°6¸;Ó"G€CÔà×)Ò)ä	ˆs�‰Ó	ô	Bó 
 ð	Bð ,×3Ñ3°D¸#Ó>ˆŒà $€CÔØøôE 'ò ÙØÜ˜C §¡°°1·6±6°(¸!¨}Ô=Üûð	ûð ×&Ñ&ò Ü˜C §¡Ð/EÔFÙðús+   Ä A H ÅI È	IÈ$(IÉIÉ&JÊJc           	     ó¾   — t        j                  | «      xrG t        | d«       xr8 t        | j                  «      j                  t        t        | di «      «      «      S )aB  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(   r-   )ÚdataclassesrI   r]   ÚsetÚ__dataclass_fields__Ú
issupersetra   )Ú_clss    r0   Úis_builtin_dataclassrx   Ô   sZ   € ô> 	× Ñ  Ó&ò 	aÜ˜Ð6Ó7Ð7ò	aä�×)Ñ)Ó*×5Ñ5´c¼'À$ÐHYÐ[]Ó:^Ó6_Ó`ðr/   )NN)r5   ztype[StandardDataclass]r2   úNsResolver | Noner4   z_config.ConfigWrapper | NonerX   rY   )r5   ú	type[Any]r4   z_config.ConfigWrapperr8   Úboolr2   ry   r9   r{   rX   r{   )rw   rz   rX   z"TypeGuard[type[StandardDataclass]]):r,   Ú
__future__r   Ú_annotationsrs   rg   r^   Ú	functoolsr   r   r   r   Úpydantic_corer   r	   r
   r   Útyping_extensionsr   Úerrorsr   Úplugin._schema_validatorr   r   r   Ú r   r   Ú_fieldsr   Ú_generate_schemar   Ú	_genericsr   Ú_mock_val_serr   Ú_namespace_utilsr   Ú_schema_generation_sharedr   Ú
_signaturer   Ú_utilsr   ÚTYPE_CHECKINGÚ	_typeshedr   ÚStandardDataclassÚconfigr   r6   r   ÚProtocolr!   r`   r7   rq   rx   r.   r/   r0   Ú<module>r‘      s  ðÙ 6å 2ã Û Û ß $ß  ÷ó õ (å 0ß XÝ 0ß "Ý -Ý ,Ý 0Ý .Ý (Ý CÝ 3Ý &à	×ÒÝ@å#Ý"ôUÐ-¨v¯©õ Uð0 3Ðð
 &*Ø37ð%Ø	 ð%à"ð%ð 1ð%ð 
ó	%ð0 Ø%)Øñ|Ø	ð|à)ð|ð ð	|ð
 #ð|ð ð|ð 
ó|ô~"r/   