OwlCyberSecurity - MANAGER
Edit File: _fields.cpython-311.pyc
� ����~�e.����������������������N����d�Z�ddlmZ�ddlZddlZddlZddlmZ�ddlm Z m Z �ddlmZ�ddl mZ�dd lmZ�dd lmZ�ddlmZ�ddlmZmZmZmZ�e rd dlmZ�d dlmZ�ddlmZ�ddlm Z � � �d7d8d�Z!�G�d��de������������Z"�G�d��de"e������������Z#dd �d9d+�Z$d:d/�Z%dd �d;d2�Z&d<d5�Z'd<d6�Z(dS�)=zmPrivate logic related to fields (the `Field()` function and `FieldInfo` class), and arguments to `Annotated`.�����)�annotationsN)�copy)� TYPE_CHECKING�Any)�BaseMetadata)�PydanticUndefined����)� _typing_extra)� ConfigWrapper)�Representation)�get_cls_type_hints_lenient�get_type_hints�is_classvar�is_finalvar������ FieldInfo�� BaseModel)�StandardDataclass)�DecoratorInfosF�objr����localns�dict[str, Any] | None�include_extras�bool�return�dict[str, Any]c����������������������t����������|�dd������������}d}|r) �t����������j��������|���������j��������}n#�t����������$�r�Y�nw�xY�wt����������|�|||�������������S�)a���Gets type hints for an object by inferring the global namespace. It uses the `typing.get_type_hints`, The only thing that we do here is fetching global namespace from `obj.__module__` if it is not `None`. Args: obj: The object to get its type hints. localns: The local namespaces. include_extras: Whether to recursively include annotation metadata. Returns: The object type hints. � __module__N)�globalnsr���r���)�getattr�sys�modules�__dict__�KeyErrorr���)r���r���r����module_namer!���s��� �O/opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py�get_type_hints_infer_globalnsr)������sr������$��#�|�T�2�2�K�&*�H���� ��{�;�/�8�H�H���� �� �� ��D� ������#��'�R`�a�a�a�as����/�� <�<c������������������������e�Zd�ZdZdZdS�)�PydanticMetadataz0Base class for annotation markers like `Strict`.��N)�__name__r ����__qualname__�__doc__� __slots__r,��������r(���r+���r+���6���s��������������:�:��I�I�Ir1���r+���c������������������������e�Zd�ZdZdd�ZdS�)�PydanticGeneralMetadataz*Pydantic general metada like `max_digits`.�metadatar���c����������������������||�_���������d�S��N)r%���)�selfr4���s��� r(����__init__z PydanticGeneralMetadata.__init__?���s ������ �� � � r1���N)r4���r���)r-���r ���r.���r/���r8���r,���r1���r(���r3���r3���<���s.��������������4�4�!��!��!��!��!��!r1���r3���)�typevars_map�cls�type[BaseModel]�bases�tuple[type[Any], ...]�config_wrapperr����types_namespacer9����dict[Any, Any] | None�%tuple[dict[str, FieldInfo], set[str]]c����������������$�����ddl�m}�t����������|�|������������}|�j�����������������������������di�������������}i�}t������������������������} |�����������������������������������D��]\���} �dk����r� |j��������D�]�}����������������������|������������r�|D�]X}t����������|�������������rFddl m} �t����������|| ������������r �|j ��������v�s't����������d���dt����������|���������������d|��d ���������������Yt!�����������fd �|j��������D���������������������������}t#����������j��������d���d|��d|��d �t&�������������������������t)����������| ������������r| �������������������������������������t-����������| t����������|��t.����������������������������������r| �������������������������������������+t1�����������������������s��<|�j��������r�dk����rt����������d��d��������������t����������|�di����������������������������������d������������}|D�]v}d��t5����������j��������|������������rt5����������j���������|������������ndD���������������}t����������|�������������r0||u�r�K�|v�r�Pt#����������j��������d���d|j����������d�t&������������������������w �t����������|��t.����������������������}|t.����������u�rt:����������� ��|j��������| |������������} �t?����������|���������������n�#�t:����������$�r�Y�n�w�xY�w#�t:����������$�r{��|v�r�|j ��������| ������������}nci�}|�j!��������ddd����������D�]&}|�"��������������������t����������|di���������������������������'�|v�rtG����������|����������������������}n�|j ��������| ������������}Y�nw�xY�w|�j��������d���������}�|j$��������v�rtK����������d�������������||�<�����|r-|�&����������������������������������D�]}|�'��������������������||��������������|| fS�)a[��Collect the fields of a nascent pydantic model. Also collect the names of any ClassVars present in the type hints. The returned value is a tuple of two items: the fields dict, and the set of ClassVar names. Args: cls: BaseModel or dataclass. bases: Parents of the class, generally `cls.__bases__`. config_wrapper: The config wrapper instance. types_namespace: Optional extra namespace to look for types in. typevars_map: A dictionary mapping type variables to their concrete types. Returns: A tuple contains fields and class variables. Raises: NameError: - If there is a conflict between a field name and protected namespaces. - If there is a field other than `root` in `RootModel`. - If a field shadows an attribute in the parent model. r���r����__annotations__�model_configr���zField "z" conflicts with member z of protected namespace "z".c��������������3���F����K����|�]}�����������������������|�������������|V����d�S�r6����� startswith)�.0�x�ann_names��� �r(���� <genexpr>z'collect_model_fields.<locals>.<genexpr>}���sK������������-��-��h�Na�Na�bc�Nd�Nd�-��-��-��-��-��-��-r1���z)" has conflict with protected namespace "z_". You may be able to resolve this warning by setting `model_config['protected_namespaces'] = z`.�rootzUnexpected field with name z4; only 'root' is allowed as a field of a `RootModel`�__pydantic_generic_metadata__�originc����������������������h�|�] }|j����������� S�r,�����name)rH����fields��� r(���� <setcomp>z'collect_model_fields.<locals>.<setcomp>����s'������� �� �� �$�� � �� �� r1���r,���zField name "z"" shadows an attribute in parent "z"; N����model_fields�__pydantic_decorators__z0you can't override a field with a computed field)(�fieldsr���r ���r%����get�set�items�protected_namespacesrG����hasattr�mainr���� issubclassrU���� NameErrorr"����tuple�warnings�warn�UserWarningr����add�_is_finalvar_with_default_valr����is_valid_field_name�__pydantic_root_model__�dataclasses�is_dataclassr.����AttributeError�from_annotated_attribute�delattr�from_annotation� __bases__�updater����computed_fields� ValueError�values�apply_typevars_map)r:���r<���r>���r?���r9���r���� type_hintsr���rW���� class_vars�ann_type�protected_namespace�br����valid_namespaces�generic_origin�base�dataclass_fields�default� field_info�model_fields_lookuprI���� decoratorsrR���rJ���s��� @r(����collect_model_fieldsr����C���s������<�#�"�"�"�"�"�+�C��A�A�J���,�"�"�#4�b�9�9�K�#%�F��5�5�J�(�.�.�0�0��b&��b&���(��~�%�%�� �#1�#F�� �� ���"�"�#6�7�7�� ������A��q�(�+�+���4�4�4�4�4�4� *�1�i� 8� 8���X���=W�=W�"+�!T�(��!T��!T�G�TU�W_�L`�L`��!T��!T�<O�!T��!T��!T�#��#���� �(-��-��-��-��-�#1�#F�-��-��-��(��(�$���M�Y�(��Y��Y�Uh��Y��Y�DT�Y��Y��Y��$� ��������x� � �� ��N�N�8�$�$�$��(��7�3��J[�3\�3\�]�]�� ��N�N�8�$�$�$��"�8�,�,�� ���&�� �8�v�+=�+=��n�h�n�n�n����� ��!��&E�r�J�J�N�N�x�X�X���� �� �D� �� �EP�E]�^b�Ec�Ec�)k��);�D�)A�)A�)A�ik� �� �� ����t�X�&�&�� ��>�)�)���/�/�/���� �e�8�e�e�t�O`�e�e�e�������� ��c�8�->�?�?�G��+�+�+�$�$��,�*�<��;�H�g�N�N�J� ���X�&�&�&�&��!�� �� �� ��� �����3��� E�� E�� E��;�&�&�6�Y�6�x�@�@� � ��=?�#���t�t��t�,��O��O�A�'�.�.�w�q�.�"�/M�/M�N�N�N�N��2�2�2��"&�&9�(�&C�!D�!D�J�J� �";��!:�8�!D�!D�J���# E����<�&)�\�2K�%L� ��z�1�1�1��O�P�P�P�%��x�����D��]�]�_�_�� D�� D�E��$�$�\�?�C�C�C�C��:��s%����&J+� J� J(�'J(�+BL0�/L0�type_� type[Any]�valc����������������������ddl�m}�t����������|�������������sdS�|t����������u�rdS�t ����������||������������r|j��������t����������u�r |j���������dS�dS�)Nr���r���FT)rW���r���r���r���� isinstancer}����default_factory)r����r����r���s��� r(���re���re�������sk������"�"�"�"�"�"��u������u� �!� !� !��u� �C�� #� #�����8I�)I�)I�c�Na�Ni��u��tr1����type[StandardDataclass]�dict[str, FieldInfo]c��������������������ddl�m}�i�}|�j��������}t����������t ����������|�������������������������}|�����������������������������������D�]�\��}}t ����������j��������|j��������||������������} t����������| ������������r�0|j ��������s|j��������t����������j ��������k����r�Mt����������|j��������|������������r$|j��������j��������r�o�|j��������| |j��������������������} n�|j��������| |������������} | ||<���| j��������t$����������ur5t����������t'����������|�|| ������������|������������rt)����������|�|| j�����������������������|r-|�����������������������������������D�]}|���������������������||��������������|S�)a��Collect the fields of a dataclass. Args: cls: dataclass. types_namespace: Optional extra namespace to look for types in. typevars_map: A dictionary mapping type variables to their concrete types. Returns: The dataclass fields. r���r���)rW���r����__dataclass_fields__�dict�varsrZ���r ����eval_type_lenient�typer����initr����rh����MISSINGr����r}����init_varrk���r���r"����setattrrr���rs���)r:���r?���r9���r���rW���r|����cls_localnsrJ����dataclass_fieldrv���r~���rR���s��� r(����collect_dataclass_fieldsr��������s�������#�"�"�"�"�"�#%�F�58�5M���t�C�y�y�/�/�K�%5�%;�%;�%=�%=��7��7�!��/� �2�?�3G��Ze�f�f���x� � �� ���#�� ��(G�;�K^�(^�(^�� ��o�-�y�9�9�� W��&�/�� ��;��;�H�o�F]�^�^�J�J�;��;�H�o�V�V�J�%��x����%6�6�6�:�g�c�S[�]g�Fh�Fh�js�;t�;t�6��C��:�#5�6�6�6����D��]�]�_�_�� D�� D�E��$�$�\�?�C�C�C�C��Mr1���rQ����strc�����������������.�����|�����������������������d�������������S�)N�_rF���rP���s��� r(���rf���rf�����s���������s�#�#�#�#r1���c�����������������X�����|�����������������������d������������o|�����������������������d�������������S�)Nr�����__rF���rP���s��� r(����is_valid_privateattr_namer������s(�������?�?�3���=�����(=�(=�$=�=r1���)NF)r���r���r���r���r���r���r���r���)r:���r;���r<���r=���r>���r���r?���r���r9���r@���r���rA���)r����r����r����r���r���r���)r:���r����r?���r���r9���r@���r���r����)rQ���r����r���r���))r/���� __future__r����_annotationsrh���r#���ra���r����typingr���r����annotated_typesr���� pydantic_corer�����r ����_configr����_reprr���r ���r���r���r���rW���r���r]���r����_dataclassesr����_decoratorsr���r)���r+���r3���r����re���r����rf���r����r,���r1���r(����<module>r�������sF�����s��s��2��2��2��2��2��2���������� � � � �������������������%��%��%��%��%��%��%��%��(��(��(��(��(��(��+��+��+��+��+��+��������������"��"��"��"��"��"��!��!��!��!��!��!��_��_��_��_��_��_��_��_��_��_��_��_���,�"�"�"�"�"�"� � � � � � �/�/�/�/�/�/�+�+�+�+�+�+� �&*� �b��b��b��b��b�:���������~�������!��!��!��!��!�.���!��!��!��+/� P��P��P��P��P��P�f �� �� �� ��tx�.��.��.��.��.��.�b$��$��$��$�>��>��>��>��>��>r1���