Your IP : 3.15.138.214


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/pyrsistent/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/pyrsistent/__pycache__/_pclass.cpython-311.pyc

�

O�Dg�%����ddlmZmZmZmZddlmZmZmZm	Z	m
Z
mZddlm
Z
d�ZGd�de��Ze��Zd�ZGd�d	ee�
��ZGd�de��Zd
S)�)�InvariantException�CheckedType�_restore_pickle�store_invariants)�
set_fields�
check_type�is_field_ignore_extra_complaint�PFIELD_NO_INITIAL�	serialize�check_global_invariants��	transformc�J�t|��dko|dtkS)N�r)�lenr)�basess �r/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/pyrsistent/_pclass.py�
_is_pclassrs ���u�:�:��?�6�u�Q�x�;�6�6�c���eZdZ�fd�Z�xZS)�
PClassMetac�*��t||d���t||dd��dtd�|dD����z|d<t|��r|dxxdz
cc<t	t
|���||||��S)	N�_pclass_fields)�name�_pclass_invariants�
__invariant__)�_pclass_frozenc3�K�|]}|V��dS�N�)�.0�keys  r�	<genexpr>z%PClassMeta.__new__.<locals>.<genexpr>s"����6\�6\�s�s�6\�6\�6\�6\�6\�6\r�	__slots__)�__weakref__)rr�tupler�superr�__new__)�mcsrr�dct�	__class__s    �rr(zPClassMeta.__new__
s�����3��$4�5�5�5�5���e�%9�?�K�K�K�.��6\�6\�c�JZ�F[�6\�6\�6\�1\�1\�\��K���e���	1������ 0�0�����Z��%�%�-�-�c�4���D�D�Dr)�__name__�
__module__�__qualname__r(�
__classcell__�r+s@rrrsA�������
E�
E�
E�
E�
E�
E�
E�
E�
Errc��t||||��|�|��\}}|s|�|��dSt|||��dSr)r�	invariant�append�setattr)�cls�fieldr�value�result�invariant_errors�is_ok�
error_codes        r�_check_and_set_attrr<sf���s�E�4��'�'�'�����.�.��E�:��%����
�+�+�+�+�+����e�$�$�$�$�$rc���eZdZdZ�fd�Zd�Zedd���Zdd�Zd�Z	d	�Z
d
�Zd�Z�fd�Z
d
�Zd�Zd�Zd�Zd�Zd�Z�xZS)�PClassa�
    A PClass is a python class with a fixed set of specified fields. PClasses are declared as python classes inheriting
    from PClass. It is defined the same way that PRecords are and behaves like a PRecord in all aspects except that it
    is not a PMap and hence not a collection but rather a plain Python object.


    More documentation and examples of PClass usage is available at https://github.com/tobgu/pyrsistent
    c	���tt|���|��}|�dd��}|�dd��}g}g}|j���D�]\}}||vrv|�||vrPt
t||��r|�|||���}	n$|�||��}	n||}	t||||	||��||=��|j	turDt|j	��r|�	��n|j	}
t||||
||����|jr.|�
d�|j|������	|s|r+t!t#|��t#|��d���|r;t%d�d�|��|j�����t)||j��d|_|S)	N�_factory_fields�ignore_extra)rAz{0}.{1}zField invariant failedz0'{0}' are not among the specified fields for {1}�, T)r'r>r(�popr�itemsr	�factoryr<�initialr
�callable�	mandatoryr3�formatr,rr&�AttributeError�joinrrr)r5�kwargsr8�factory_fieldsrA�missing_fieldsr9rr6r7rFr+s           �rr(zPClass.__new__.s"����v�s�#�#�+�+�C�0�0�����$5�t�<�<���z�z�.�$�7�7�������-�3�3�5�5�	L�	L�K�D�%��v�~�~�!�)�T�^�-C�-C�6�v�u�l�S�S�<� %�
�
�f�T�l��
� V� V��� %�
�
�f�T�l� ;� ;���"�4�L�E�#�C���e�V�EU�V�V�V��4�L�L���&7�7�7�-5�e�m�-D�-D�W�%�-�-�/�/�/�%�-��#����g�v�7G�I�I�I�I���
L��%�%�i�&6�&6�s�|�T�&J�&J�K�K�K���	o�~�	o�$�U�+;�%<�%<�e�N�>S�>S�Um�n�n�n��	2� �!S�!Z�!Z��	�	�&�!�!�3�<�"1�"1�2�2�
2�	 ���(>�?�?�?� $����
rc���|r|d||d<t|��}|jD]*}||vr$t||t��}|tur|||<�+|jdd|i|��S)a
        Set a field in the instance. Returns a new instance with the updated value. The original instance remains
        unmodified. Accepts key-value pairs or single string representing the field name and a value.

        >>> from pyrsistent import PClass, field
        >>> class AClass(PClass):
        ...     x = field()
        ...
        >>> a = AClass(x=1)
        >>> a2 = a.set(x=2)
        >>> a3 = a.set('x', 3)
        >>> a
        AClass(x=1)
        >>> a2
        AClass(x=2)
        >>> a3
        AClass(x=3)
        rrr@r )�setr�getattr�_MISSING_VALUEr+)�self�argsrLrMr"r7s      rrPz
PClass.setRs���&�	&�"�1�g�F�4��7�O��V�����&�	(�	(�C��&� � ���c�>�:�:����.�.�"'�F�3�K���t�~�G�G�n�G��G�G�GrNFc�h��t�|��r�S|r�fd�|jD���|d||d����S)a:
        Factory method. Will create a new PClass of the current type and assign the values
        specified in kwargs.

        :param ignore_extra: A boolean which when set to True will ignore any keys which appear in kwargs that are not
                             in the set of fields on the PClass.
        c�*��i|]}|�v�|�|��Sr r )r!�krLs  �r�
<dictcomp>z!PClass.create.<locals>.<dictcomp>s$���N�N�N�q�!�v�+�+�a����+�+�+r)r@rAr )�
isinstancer)r5rLr@rAs `  r�createz
PClass.creaters_����f�c�"�"�	��M��	O�N�N�N�N�C�,>�N�N�N�F��s�X�?��X�X�QW�X�X�Xrc��i}|jD]E}t||t��}|tur$t|j|j||��||<�F|S)z�
        Serialize the current PClass using custom serializer functions for fields where
        such have been supplied.
        )rrQrRr�
serializer)rSrIr8rr7s     rrzPClass.serialize�s`��
���'�	^�	^�D��D�$��7�7�E��N�*�*�(��)<�T�)B�)M�v�W\�]�]��t����
rc�"�t||��S)aT
        Apply transformations to the currency PClass. For more details on transformations see
        the documentation for PMap. Transformations on PClasses do not support key matching
        since the PClass is not a collection. Apart from that the transformations available
        for other persistent types work as expected.
        r
)rS�transformationss  rrzPClass.transform�s�����/�/�/rc��t||j��r=|jD]3}t||t��t||t��krdS�4dSt
S)NFT)rYr+rrQrR�NotImplemented)rS�otherrs   r�__eq__z
PClass.__eq__�se���e�T�^�,�,�	��+�
!�
!���4��~�6�6�'�%��~�:^�:^�^�^� �5�5�_��4��rc��||kSrr )rSras  r�__ne__z
PClass.__ne__�s���5�=� � rc�^��tt�fd��jD������S)Nc3�H�K�|]}|t�|t��fV��dSr)rQrR�r!r"rSs  �rr#z"PClass.__hash__.<locals>.<genexpr>�s4�����c�c��3���c�>� B� B�C�c�c�c�c�c�cr)�hashr&r�rSs`r�__hash__zPClass.__hash__�s1����E�c�c�c�c�t�Ob�c�c�c�c�c�d�d�drc����t|dd��r#td�||�����tt|���||��dS)NrFz'Can't set attribute, key={0}, value={1})rQrJrIr'r>�__setattr__�rSr"r7r+s   �rrlzPClass.__setattr__�s`����4�)�5�1�1�	_� �!J�!Q�!Q�RU�W\�!]�!]�^�^�^�
�f�d���'�'��U�3�3�3�3�3rc�F�td�|�����)Nz-Can't delete attribute, key={0}, use remove())rJrI)rSr"s  r�__delattr__zPClass.__delattr__�s �� �!P�!W�!W�X[�!\�!\�]�]�]rc�f�i}|jD]&}t||t��}|tur|||<�'|Sr)rrQrR)rSr8r"r7s    r�_to_dictzPClass._to_dict�sD�����&�	$�	$�C��D�#�~�6�6�E��N�*�*�#��s����
rc���d�|jjd�d�|������D������S)Nz{0}({1})rBc3�bK�|]*\}}d�|t|����V��+dS)z{0}={1}N)rI�repr)r!rW�vs   rr#z"PClass.__repr__.<locals>.<genexpr>�s<����*l�*l�D�A�q�9�+;�+;�A�t�A�w�w�+G�+G�*l�*l�*l�*l�*l�*lr)rIr+r,rKrqrDris r�__repr__zPClass.__repr__�s[��� � ���!8�!%���*l�*l�TX�Ta�Ta�Tc�Tc�Ti�Ti�Tk�Tk�*l�*l�*l�!l�!l�n�n�	nrc�d��t�fd��jD����}t�j|ffS)Nc3�\�K�|]&}t�|���|t�|��fV��'dSr)�hasattrrQrgs  �rr#z$PClass.__reduce__.<locals>.<genexpr>�sD�����c�c�#�PW�X\�^a�Pb�Pb�c�S�'�$��,�,�-�c�c�c�c�c�cr)�dictrrr+)rS�datas` r�
__reduce__zPClass.__reduce__�s:����c�c�c�c��9L�c�c�c�c�c������ 7�7�7rc�F�t||�����S)z5
        Returns an evolver for this object.
        )�_PClassEvolverrqris r�evolverzPClass.evolver�s���d�D�M�M�O�O�4�4�4rc�X�|���}||=|���S)z�
        Remove attribute given by name from the current instance. Raises AttributeError if the
        attribute doesn't exist.
        )r�
persistent)rSrrs   r�removez
PClass.remove�s*��
�,�,�.�.���D�M��!�!�#�#�#r�NFr)r,r-r.�__doc__r(rP�classmethodrZrrrbrdrjrlrorqrvr|rr�r/r0s@rr>r>%sF���������"�"�"�"�"�HH�H�H�@�Y�Y�Y��[�Y� ����0�0�0����!�!�!�e�e�e�4�4�4�4�4�^�^�^����n�n�n�8�8�8�
5�5�5�$�$�$�$�$�$�$rr>)�	metaclassc�R��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
�fd	�Zd
�Z�xZ
S)r~)�_pclass_evolver_original�_pclass_evolver_data�_pclass_evolver_data_is_dirtyr@c�V�||_||_d|_t��|_dSr�)r�r�r�rPr@)rS�original�initial_dicts   r�__init__z_PClassEvolver.__init__�s,��(0��%�$0��!�-2��*�"�u�u����rc��|j|Sr)r��rS�items  r�__getitem__z_PClassEvolver.__getitem__�s���(��.�.rc��|j�|t��|ur+||j|<|j�|��d|_|S�NT)r��getrRr@�addr��rSr"r7s   rrPz_PClassEvolver.set�sQ���$�(�(��n�=�=�U�J�J�-2�D�%�c�*�� �$�$�S�)�)�)�15�D�.��rc�2�|�||��dSr)rPr�s   r�__setitem__z_PClassEvolver.__setitem__�s������e�����rc��||jvr+|j|=|j�|��d|_|St	|���r�)r�r@�discardr�rJr�s  rr�z_PClassEvolver.remove�sM���4�,�,�,��)�$�/�� �(�(��.�.�.�15�D�.��K��T�"�"�"rc�0�|�|��dSr)r�r�s  r�__delitem__z_PClassEvolver.__delitem__�s�����D�����rc�Z�|jr|jjdd|ji|j��S|jS)Nr@r )r�r�r+r@r�ris rr�z_PClassEvolver.persistent�sS���-�	X�:�4�0�:�X�X�4�K_�X�=A�=V�X�X�
X��,�,rc���||jvr|�||��dStt|���||��dSr)r$rPr'r~rlrms   �rrlz_PClassEvolver.__setattr__�sP����d�n�$�$��H�H�S�%� � � � � ��.�$�'�'�3�3�C��?�?�?�?�?rc��||Srr r�s  r�__getattr__z_PClassEvolver.__getattr__s���D�z�r)r,r-r.r$r�r�rPr�r�r�r�rlr�r/r0s@rr~r~�s��������x�I�%�%�%�/�/�/�������#�#�#����-�-�-�@�@�@�@�@�������rr~N)�pyrsistent._checked_typesrrrr�pyrsistent._field_commonrrr	r
rr�pyrsistent._transformationsrr�typer�objectrRr<r>r~r rr�<module>r�sY��j�j�j�j�j�j�j�j�j�j�j�j�����������������2�1�1�1�1�1�7�7�7�E�E�E�E�E��E�E�E������%�%�%�m$�m$�m$�m$�m$�[�J�m$�m$�m$�m$�`1�1�1�1�1�V�1�1�1�1�1r

?>