Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
dataclasses.cpython-313.pyc141 linesDownload Raw Back to __pycache__
1�

2��jJ�
�V�SrSSKJr SSKrSSKrSSKrSSKrSSKJ	r	J3r4JrJrJ
r
JrJrJr SSKJr SSKJrJr SSKJrJrJrJrJr SS	KJr SS5KJr SSK J!r! SSK"J#r# SS
K$J%r%J&r&J'r' \	(aSSK(J)r) SSK*J+r+ Sr,\"S5r-\R\S:�a�\"\R^\%\'4S9\SSSSSSSSSSS.6S%Sjj55r0\"\R^\%\'4S9\SSSSSSSSSSS.7S&Sjj55r0Oz\"\R^\%\'4S9\SSSSSSSSS.S'Sjj55r0\"\R^\%\'4S9\SSSSSSSSS.S(Sjj55r0\"\R^\%\'4S9S)SSSSSSSSSSS.8S*Sjjj5r0S+Sjr1\"\25r3\R\S:aS,S jr4\4\Rjl6SSS!SS".S-S#jjr7S.S$jr8g)/z7Provide an enhanced dataclass that performs validation.�)�annotationsN)�
TYPE_CHECKING�Any�Callable�Generic�Literal�NoReturn�TypeVar�overload)�warn)�	TypeGuard�dataclass_transform�)�_config�_decorators�
_mock_val_ser�_namespace_utils�
_typing_extra)�_dataclasses)�getattr_migration)�9ConfigDict)�PydanticUserError)�Field�	FieldInfo�PrivateAttr)�PydanticDataclass)�MappingNamespace)�	dataclass�rebuild_dataclass�_T���10)�field_specifiersFT.�11�init�repr�eq�order�unsafe_hash�frozen�config�validate_on_init�kw_only�slotsc12��g�N�r%s13          �ZD:\code\apps\devtools\python\user_packages\Python313\site-packages\pydantic/dataclasses.pyrrs��	�c14��gr1r2)�_clsr&r'r(r)r*r+r,r-r.r/s           r3rr0s��#&r4�r&r'r(r)r*r+r,r-c��gr1r2r7s        r3rrCs��	r4c��gr1r2)	r6r&r'r(r)r*r+r,r-s	         r3rrRs��#&r4c15	�^^^^^^^16^�USLdS5eUSLdS5e[RS:�aU	T17S.mO0mSUUUUUUU18U4SjjnUcU$U"U5$)ar!!! abstract "Usage Documentation"19    [`dataclasses`](../concepts/dataclasses.md)20 21A decorator used to create a Pydantic-enhanced dataclass, similar to the standard Python `dataclass`,22but with added validation.23 24This function should be used similarly to `dataclasses.dataclass`.25 26Args:27    _cls: The target `dataclass`.28    init: Included for signature compatibility with `dataclasses.dataclass`, and is passed through to29        `dataclasses.dataclass` when appropriate. If specified, must be set to `False`, as pydantic inserts its30        own  `__init__` function.31    repr: A boolean indicating whether to include the field in the `__repr__` output.32    eq: Determines if a `__eq__` method should be generated for the class.33    order: Determines if comparison magic methods should be generated, such as `__lt__`, but not `__eq__`.34    unsafe_hash: Determines if a `__hash__` method should be included in the class, as in `dataclasses.dataclass`.35    frozen: Determines if the generated class should be a 'frozen' `dataclass`, which does not allow its36        attributes to be modified after it has been initialized. If not set, the value from the provided `config` argument will be used (and will default to `False` otherwise).37    config: The Pydantic config to use for the `dataclass`.38    validate_on_init: A deprecated parameter included for backwards compatibility; in V2, all Pydantic dataclasses39        are validated on init.40    kw_only: Determines if `__init__` method parameters must be specified by keyword only. Defaults to `False`.41    slots: Determines if the generated class should be a 'slots' `dataclass`, which does not allow the addition of42        new attributes after instantiation.43 44Returns:45    A decorator that accepts a class as its argument and returns a Pydantic `dataclass`.46 47Raises:48    AssertionError: Raised if `init` is not `False` or `validate_on_init` is `False`.49Fz7pydantic.dataclasses.dataclass only supports init=Falsez-validate_on_init=False is no longer supportedr!)r.r/c��>^^�SSKJn U"U5(a[SURS3SS9eUn[	SUR5055nU(d1Tb.[
US	5(a[S51URS3[SS
9 TbTO[US	S5n[R"U5n[RRUSS9nURU5 UR n["R$"U5(aSSnU4n['U[(5(a[(UR*n	X�4-n[,R."URU5nTb2TmUR0(a[SUR<S3[SS
9 OUR0=(d Sm[2R4"U5n52U53HFn[XS5n[7U[85(dM&[;X["R<"U55 MH ["R>"U5 [@RB"U4STTTTTS.TD6nSSS5 URD(a}URFm[HRJ"URF5SUU4Sjj5n
U
RMSU5Ul#T(a'[
US5(dSSjnSSjnX�l'X�l(SUl)X`l*Xpl[USS5nURVUl+[XRZS:�aUbUUl.UUl.UR^Ul/[a[b5Ul2SUl3["Rh"XSS9 U$!,(df   GN6=f)z�Create a Pydantic dataclass from a regular dataclass.54 55Args:56    cls: The class to create the Pydantic dataclass from.57 58Returns:59    A Pydantic dataclass.60r)�is_model_classz(Cannot create a Pydantic dataclass from z" as it is already a Pydantic modelzdataclass-on-model)�codec3�N# �UHn[R"U5v� M g7fr1)�dataclasses�is_dataclass)�.0�bases  r3�	<genexpr>�6dataclass.<locals>.create_dataclass.<locals>.<genexpr>�s��� Z�M�D��!9�!9�$�!?�!?�M�s�#%N�__pydantic_config__z[`config` is set via both the `dataclass` decorator and `__pydantic_config__` for dataclass zK. The `config` specification from `dataclass` decorator will take priority.�)�category�61stacklevelT)�replace_wrapped_methodszN`frozen` is set via both the `dataclass` decorator and `config` for dataclass zW.This is not recommended. The `frozen` specification on `dataclass` will take priority.F)r&r'r(r)r*r+c�P>�T(a	T"XU5$[U5n[X1S5n[U[5(aUR	X5 g[U[62R5(aURRX5 gURRXU5 gr1)�type�getattr�63isinstance�property�__set__�	functools�cached_property�__dict__�__setitem__�__pydantic_validator__�validate_assignment)�instance�name�value�inst_cls�attr�frozen_�original_setattrs     ��r3�validated_setattr�>dataclass.<locals>.create_dataclass.<locals>.validated_setattr�s����+�H�E�B�B���>���x�t�4���d�H�-�-��L�L��1���i�&?�&?�@�@��%�%�1�1�$�>��3�3�G�G��X]�^r4�__setstate__c��[R"U5Vs/sHn[XR5PM sn$s snfr1)r?�fieldsrLrW)�self�fs  r3�_dataclass_getstate�@dataclass.<locals>.create_dataclass.<locals>._dataclass_getstates0��;F�;M�;M�d�;S�T�;S�a�G�D�&�&�1�;S�T�T��Ts�;c��[[R"U5U5H%up#[R	XR64U5 M' gr1)�zipr?ra�object�__setattr__rW)rb�state�fieldrXs    r3�_dataclass_setstate�@dataclass.<locals>.create_dataclass.<locals>._dataclass_setstates5��(+�K�,>�,>�t�,D�e�(L����*�*�4���U�C�)Mr4�__firstlineno__)r"�
)�raise_errors)rVrrW�strrXr�return�None)rbrrr�	list[Any])rbrrjrtrrrs)5�_internal._utilsr<r�__name__�any�	__bases__�hasattrr�UserWarningrLr�
ConfigWrapperr�DecoratorInfos�build�update_from_config�__doc__�_pydantic_dataclasses�is_stdlib_dataclass�65issubclassr�__parameters__�types�	new_classr+r�safe_get_annotationsrMr�setattr�as_dataclass_field�patch_base_fieldsr?rrUrirP�wraps�__get__�__getstate__r_�__is_pydantic_dataclass__�__pydantic_decorators__�66__module__�sys�version_inforn�__qualname__�classmethod�_pydantic_fields_complete�__pydantic_fields_complete__�__pydantic_complete__�complete_dataclass)�clsr<�original_cls�has_dataclass_base�config_dict�config_wrapper�67decorators�original_doc�bases�generic_base�cls_anns�68field_name�field_valuer]rdrl�firstlinenor[r\r,r(r+�kwargsr)r'r/r*s                 @@��������r3�create_dataclass�#dataclass.<locals>.create_dataclass�sH���	5��#���#�:�3�<�<�.�Hj�k�)��
�69��!� Z�C�M�M� Z�Z��!�f�&8�W�S�J_�=`�=`��m�nq�nz�nz�m{�|\�]�$��	
�!'� 2�f���EZ�\`�8a�� �.�.�{�;�� �/�/�5�5�c�SW�5�X�70��%�%�n�5�71�{�{�� �4�4�S�9�9� �L�72�F�E��#�w�'�'�&�s�'9�'9�:����/���/�/�#�,�,��6�C����G��$�$��d�eh�eq�eq�dt�um�m�(� �	��%�+�+�4�u�G�!�5�5�c�:��"�J�"�#�4�8�K��+�y�1�1���)>�)Q�)Q�R]�)^�_�#�#�
4�
4�S�
9��'�'��73�����'��74��75�C�:��-�-�"����
�_�_�S�_�_�
-�
_�.�
_�0�7�7��c�B�C�O��W�S�.�9�9�U�D�$7� �#6� �)-��%�&0�#�"���l�,=�t�D��%�0�0������w�&�;�+B�,7�L�(�"-�C��'�4�4���+6�7P�+Q��(�$)��!�	�0�0��SX�Y��76�S:�
9�s�M&�&77M5)r��	type[Any]rr�type[PydanticDataclass])r�r�)
r6r&r'r(r)r*r+r,r-r.r/r�r�s
  ``````  ` @r3rrbsn���^�5�=�S�S�S�=��5�(�Y�*Y�Y�(�78���7�"�$�u�5����^�^�@ $�|��G�1A�$�1G�Gr4c�V�[SURR555$)z�Return whether the fields were successfully collected (i.e. type hints were successfully resolved).79 80This is a private helper, not meant to be used outside Pydantic.81c3�8# �UHoRv� M g7fr1)�	_complete)rA�82field_infos  r3rC�,_pydantic_fields_complete.<locals>.<genexpr>As���W�6V�83�#�#�6V�s�)�all�__pydantic_fields__�values)r�s r3r�r�<s$��84�W�c�6M�6M�6T�6T�6V�W�W�Wr4)r"�c��[S5e)a!This function does nothing but raise an error that is as similar as possible to what you'd get85if you were to try calling `InitVar[int]()` without this monkeypatch. The whole purpose is just86to ensure typing._type_check does not error if the type hint evaluates to `InitVar[<parameter>]`.87z 'InitVar' object is not callable)�	TypeError)�argsr�s  r3�
_call_initvarr�Js��88�:�;�;r4rF)�forcerp�_parent_namespace_depth�_types_namespacec���U(dUR(agSHInXPR;dM[[X5[R895(aM>[
X5 MK SUlUbUnO'US:�a[R"USS9=(d 0nO0n[R"US9n[R"U[R"URSS9UUSS	9$)90aDTry to rebuild the pydantic-core schema for the dataclass.91 92This may be necessary when one of the annotations is a ForwardRef which could not be resolved during93the initial attempt to build the schema, and automatic rebuilding fails.94 95This is analogous to `BaseModel.model_rebuild`.96 97Args:98    cls: The class to rebuild the pydantic-core schema for.99    force: Whether to force the rebuilding of the schema, defaults to `False`.100    raise_errors: Whether to raise errors, defaults to `True`.101    _parent_namespace_depth: The depth level of the parent namespace, defaults to 2.102    _types_namespace: The types namespace, defaults to `None`.103 104Returns:105    Returns `None` if the schema is already "complete" and rebuilding was not required.106    If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`.107N)�__pydantic_core_schema__rT�__pydantic_serializer__FrT)�parent_depthr�)�parent_namespace)�check)rp�ns_resolver�_force_build)r�rRrMrLr�108MockValSer�delattrr�parent_frame_namespacer�109NsResolverr�r�rr{rE)r�r�rpr�r�rZ�110rebuild_nsr�s        r3rrTs���4�S�.�.��a���<�<��111�7�3�3E�}�G_�G_�(`�(`�
�C��	b�!&�C���#�%�112�	 �1�	$�"�9�9�G^�fj�k�q�oq�113��114�"�-�-�#��K�!�3�3�����c�5�5�U�C�!��115�116�117r4c�|�SUR;=(a [R"U5$![a gf=f)z�Whether a class is a pydantic dataclass.118 119Args:120    class_: The class.121 122Returns:123    `True` if the class is a pydantic dataclass, `False` otherwise.124r�F)rRr?r@�AttributeError)�class_s r3�is_pydantic_dataclassr��s9���*�f�o�o�=�b�+�BZ�BZ�[a�Bb�b������s�+.�125;�;)r&�Literal[False]r'�boolr(r�r)r�r*r�r+r�r,� ConfigDict | type[object] | Noner-�bool | Noner.r�r/r�rr�-Callable[[type[_T]], type[PydanticDataclass]])r6�type[_T]r&r�r'r�r(r�r)r�r*r�r+r�r,r�r-r�r.r�r/r�rrr�)r&r�r'r�r(r�r)r�r*r�r+r�r,r�r-r�rrr�)r6r�r&r�r'r�r(r�r)r�r*r�r+r�r,r�r-r�rrr�r1)r6ztype[_T] | Noner&r�r'r�r(r�r)r�r*r�r+r�r,r�r-r�r.r�r/r�rrzGCallable[[type[_T]], type[PydanticDataclass]] | type[PydanticDataclass])r�r�rrr�)r�rr�rrrr	)r�r�r�r�rpr�r��intr�zMappingNamespace | Nonerrr�)r�r�rrz"TypeGuard[type[PydanticDataclass]])9r�126__future__r�_annotationsr?rPr�r��typingrrrrrr	r127r�warningsr�typing_extensionsr
r�	_internalrrrrrrr��128_migrationrr,r�errorsrrarrr�_internal._dataclassesr�_internal._namespace_utilsr�__all__r r�rkrr�rv�__getattr__r��InitVar�__call__rr�r2r4r3�<module>r�s���=�2���129��^�^�^��<�[�[�<�)��%�1�1��9�<�130*���T�]�����w���;�+<�+<�e�[�*Q�R�
� %����!��37�(,���
��
��
�
�	
�131�
��

��
�1�
�&�
��
��
�1327�
��S�
��;�+<�+<�e�[�*Q�R�
� %����!�"�37�(,���
&��
&��
&��	
&�133
�
&��

&��
&��
&�1�
&�&�
&��
&��
&�134!�
&��S�
&�"�;�+<�+<�e�[�*Q�R�
� %����!�"�37�(,������
�	�135���
���1��&��1367���S���;�+<�+<�e�[�*Q�R�
� %����!�"�37�(,�&��&��&��	&�137
�&��
&��&��&�1�&�&�&�138!�&��S�&��{�'8�'8�%��&M�N� �VH�!������/3�$(���VH�139�VH��VH��	VH�140	
�VH��
VH��VH�
�VH�
-�VH�"�VH��VH��VH�M�VH�O�VH�rX� ��)�����g��<�$1�K��� ���#$�04�
:�	 �:��:��	:�141!�:�.�
:��:�zr4
codekingpro/portable-devtools · Team Ai