OwlCyberSecurity - MANAGER
Edit File: _plist.cpython-311.pyc
� ������he �����������������������@����d�dl�mZmZ�d�dlmZ�d�dlmZ��G�d��de������������Z�G�d��de������������Z �G�d��d e ������������Z �ej��������e ��������������ej��������e ��������������G�d ��de ������������Z�ej��������e��������������ej��������e��������������e��������������Z dd�Zd��ZdS�)�����)�Sequence�Hashable)�Integral)�reducec��������������������4�����e�Zd�ZdZdZd��Zd��Zd��Zd��Zd��Z dS�) � _PListBuilderzc Helper class to allow construction of a list without having to reverse it in the end. )�_head�_tailc������������������6�����t�����������|�_��������t�����������|�_��������d�S��N)�_EMPTY_PLISTr ���r �����selfs��� �H/opt/cloudlinux/venv/lib64/python3.11/site-packages/pyrsistent/_plist.py�__init__z_PListBuilder.__init__ ���s������!�� �!�� � � �����c�����������������������|�j���������s�||������������|�_��������|�j��������|�_���������n&�||������������|�j���������_��������|�j���������j��������|�_���������|�j��������S�r���)r ���r ����rest)r����elem�constructors��� r����_appendz_PListBuilder._append���sN�������z�� )�$��T�*�*�D�J���D�J�J�)�k�$�/�/�D�J�O����D�J��z�r���c������������������0�����|�����������������������|d��������������S�)Nc������������������,�����t����������|�t����������������������S�r���)�PListr ���)�es��� r����<lambda>z+_PListBuilder.append_elem.<locals>.<lambda>���s������E�!�\�,B�,B��r����r����r���r���s��� r����append_elemz_PListBuilder.append_elem���s�������|�|�D�"B�"B�C�C�Cr���c������������������0�����|�����������������������|d��������������S�)Nc�����������������������|�S�r�����)�ls��� r���r���z,_PListBuilder.append_plist.<locals>.<lambda>���s������!��r���r���)r����pls��� r����append_plistz_PListBuilder.append_plist���s�������|�|�B���,�,�,r���c�����������������������|�j���������S�r���)r ���r���s��� r����buildz_PListBuilder.build!���s �������z�r���N) �__name__� __module__�__qualname__�__doc__� __slots__r���r���r���r%���r'���r"���r���r���r���r������ss������������������#�I�"��"��"������D��D��D�-��-��-���������r���r���c�������������������������e�Zd�ZdZej��������Zej��������Zd��Zd��Zd��Z e Z d��Zd��Zd��Z e Zd��Zd ��Zd ��Zd��Zd��Zd ��Zd��Zd��ZdS�)� _PListBase)�__weakref__c������������������0�����t�����������t����������|�������������ffS�r���)�plist�listr���s��� r���� __reduce__z_PListBase.__reduce__.���s�������t�D�z�z�m�#�#r���c������������������4�����t����������d��|�D���������������������������S�)a�� Return the length of the list, computed by traversing it. This is obviously O(n) but with the current implementation where a list is also a node the overhead of storing the length in every node would be quite significant. c��������������3�������K����|�]}d�V����dS�)����Nr"���)�.0�_s��� r���� <genexpr>z%_PListBase.__len__.<locals>.<genexpr>:���s"����������#�#��1�#�#�#�#�#�#r���)�sumr���s��� r����__len__z_PListBase.__len__2���s!��������#�#�d�#�#�#�#�#�#r���c������������������F�����d����������������������t����������|�������������������������S�)Nz plist({0}))�formatr2���r���s��� r����__repr__z_PListBase.__repr__<���s�������"�"�4��:�:�.�.�.r���c������������������"�����t����������||�������������S�)z Return a new list with elem inserted as new head. >>> plist([1, 2]).cons(3) plist([3, 1, 2]) )r���r���s��� r����consz_PListBase.cons@���s��������T�4� � � r���c������������������>�����|�}|D�]}|����������������������|������������}�|S�)a �� Return a new list with all elements of iterable repeatedly cons:ed to the current list. NB! The elements will be inserted in the reverse order of the iterable. Runs in O(len(iterable)). >>> plist([1, 2]).mcons([3, 4]) plist([4, 3, 1, 2]) �r@���)r����iterable�headr���s��� r����mconsz_PListBase.mconsI���s.����������� #�� #�D��9�9�T�?�?�D�D��r���c������������������p�����t������������������������}|�}|r#|���������������������|j��������������������}|j��������}|�#|S�)a�� Return a reversed version of list. Runs in O(n) where n is the length of the list. >>> plist([1, 2, 3]).reverse() plist([3, 2, 1]) Also supports the standard reversed function. >>> reversed(plist([1, 2, 3])) plist([3, 2, 1]) )r1���r@����firstr���)r����resultrD���s��� r����reversez_PListBase.reverseX���sE��������������� ��[�[���,�,�F��9�D���� ��� r���c������������������������t������������������������}|�}d}|r4||k�����r.|���������������������|j���������������������|j��������}|dz ��}|r||k������.|s |�t����������fS�|�����������������������������������|fS�)z� Spilt the list at position specified by index. Returns a tuple containing the list up until index and the list after the index. Runs in O(index). >>> plist([1, 2, 3, 4]).split(2) (plist([1, 2]), plist([3, 4])) r���r6���)r���r���rG���r���r ���r'���)r����index�lb� right_list�is��� r����splitz_PListBase.splitm���s���������_�_��� � ���� �Q��Y�Y��N�N�:�+�,�,�,�#��J� ��F�A���� �Q��Y�Y� ��� &���%�%��x�x�z�z�:�%�%r���c��������������#����:���K����|�}|r|j���������V���|j��������}|�d�S�d�S�r����rG���r���)r����lis��� r����__iter__z_PListBase.__iter__����sC���������� ���� ��(�N�N�N���B���� �� �� �� �� r���c������������������z�����t����������|t����������������������st����������S�t����������|�������������t����������|������������k�����S�r���)� isinstancer.����NotImplemented�tuple)r����others��� r����__lt__z_PListBase.__lt__����s1�������%��,�,�� "�!�!��T�{�{�U�5�\�\�)�)r���c�����������������������t����������|t����������������������st����������S�|�}|}|r&|r$|j��������|j��������k����sdS�|j��������}|j��������}|r|�$|�o|�S�)z� Traverses the lists, checking equality of elements. This is an O(n) operation, but preserves the standard semantics of list equality. F)rU���r.���rV���rG���r���)r���rX���� self_head� other_heads��� r����__eq__z_PListBase.__eq__����sz��������%��,�,�� "�!�!�� �� ��� )�J�� )��?�j�&6�6�6��u�!��I�#��J� ��� )�J�� )���}�/�Z��/r���c�����������������������t����������|t����������������������r\|j���������3|j���������,|j���������|j��������dk����r|����������������������|j��������������������S�t ����������t����������|�������������|���������������������S�t����������|t����������������������s$t����������dt����������|������������j��������z���������������|dk�����r|t����������|�������������z ��} �|����������������������|������������j ��������S�#�t����������$�r}t����������d������������|�d�}~ww�xY�w)Nr6���z-'%s' object cannot be interpreted as an indexr����PList index out of range)rU����slice�start�stop�step�_dropr1���rW���r���� TypeError�typer(����lenrG����AttributeError� IndexError)r���rK���r���s��� r����__getitem__z_PListBase.__getitem__����s�������e�U�#�#�� -��{�&�5�:�+=�5�:�CU�Y^�Yc�gh�Yh�Yh��z�z�%�+�.�.�.����t���U�+�,�,�,��%��*�*�� d��K�d�SX�k�k�Nb�b�c�c�c��1�9�9��S��Y�Y��E� @��:�:�e�$�$�*�*���� @�� @�� @��7�8�8�a�?����� @���s����C�� C=�(C8�8C=c������������������d�����|dk�����rt����������d�������������|�}|dk����r|j��������}|dz��}|dk�����|S�)Nr���r_���r6���)ri���r���)r����countrD���s��� r���rd���z_PListBase._drop����sJ�������1�9�9��7�8�8�8����a�i�i��9�D��Q�J�E���a�i�i���r���c������������������:�����t����������t����������|�������������������������S�r���)�hashrW���r���s��� r����__hash__z_PListBase.__hash__����s�������E�$�K�K� � � r���c�����������������������t������������������������}|�}|rH|j��������|k����r|���������������������|j��������������������S�|���������������������|j���������������������|j��������}|�Ht����������d���������������������|�������������������������)a �� Return new list with first element equal to elem removed. O(k) where k is the position of the element that is removed. Raises ValueError if no matching element is found. >>> plist([1, 2, 1]).remove(1) plist([2, 1]) z{0} not found in PList)r���rG���r%���r���r���� ValueErrorr=���)r���r����builderrD���s��� r����removez_PListBase.remove����s�������� �/�/������ ��z�T�!�!��+�+�D�I�6�6�6����� �+�+�+��9�D���� ���1�8�8��>�>�?�?�?r���N)r(���r)���r*���r,���r���rl���rK���r3���r;���r>����__str__r@���rE���rI����__reversed__rO���rS���rY���r]���rj���rd���ro���rs���r"���r���r���r.���r.���%���s������������� �I� � �N�E��N�E�$��$��$�$��$��$�/��/��/��G�!��!��!� �� �� ������&��L�&��&��&�,�����*��*��*�0��0��0�&@��@��@�. �� �� �!��!��!�@��@��@��@��@r���r.���c��������������������0�������e�Zd�ZdZdZ��fd�Zd��ZeZ��xZS�)r���a��� Classical Lisp style singly linked list. Adding elements to the head using cons is O(1). Element access is O(k) where k is the position of the element in the list. Taking the length of the list is O(n). Fully supports the Sequence and Hashable protocols including indexing and slicing but if you need fast random access go for the PVector instead. Do not instantiate directly, instead use the factory functions :py:func:`l` or :py:func:`plist` to create an instance. Some examples: >>> x = plist([1, 2]) >>> y = x.cons(3) >>> x plist([1, 2]) >>> y plist([3, 1, 2]) >>> y.first 3 >>> y.rest == x True >>> y[:2] plist([3, 1]) rQ���c������������������t������t����������t����������|����������������������������������|�������������}||_��������||_��������|S�r���)�superr����__new__rG���r���)�clsrG���r����instance� __class__s��� �r���ry���z PList.__new__����s3����������$�$�,�,�S�1�1������� ��r���c�����������������������dS�)NTr"���r���s��� r����__bool__zPList.__bool__��s�������tr���) r(���r)���r*���r+���r,���ry���r~����__nonzero__� __classcell__)r|���s���@r���r���r�������sQ������������������4�"�I����������������K�K�K�K�Kr���r���c��������������������H�����e�Zd�ZdZd��ZeZed����������������Zed����������������ZdS�)�_EmptyPListr"���c�����������������������dS�)NFr"���r���s��� r���r~���z_EmptyPList.__bool__ ��s�������ur���c������������������ �����t����������d�������������)NzEmpty PList has no first)rh���r���s��� r���rG���z_EmptyPList.first��s�������7�8�8�8r���c�����������������������|�S�r���r"���r���s��� r���r���z_EmptyPList.rest��s�������r���N) r(���r)���r*���r,���r~���r����propertyrG���r���r"���r���r���r����r���� ��sa���������������I�������K� �9��9���X�9��������X�����r���r����r"���Fc������������������z�����|s#t����������|�������������}�|�������������������������������������t����������d��|�t����������������������S�)a �� Creates a new persistent list containing all elements of iterable. Optional parameter reverse specifies if the elements should be inserted in reverse order or not. >>> plist([1, 2, 3]) plist([1, 2, 3]) >>> plist([1, 2, 3], reverse=True) plist([3, 2, 1]) c������������������,�����|�����������������������|������������S�r���rB���)r$���r���s��� r���r���zplist.<locals>.<lambda>/��s������2�7�7�4�=�=��r���)r2���rI���r���r ���)rC���rI���s��� r���r1���r1��� ��s?������������>�>���������0�0�(�L�I�I�Ir���c������������������� �����t����������|�������������S�)zj Creates a new persistent list containing all arguments. >>> l(1, 2, 3) plist([1, 2, 3]) )r1���)�elementss��� r���r#���r#���2��s���������?�?�r���N)r"���F)�collections.abcr���r����numbersr���� functoolsr����objectr���r.���r����registerr����r ���r1���r#���r"���r���r����<module>r�������s������.��.��.��.��.��.��.��.����������������������������������F�������>v@��v@��v@��v@��v@���v@��v@��v@�r%��%��%��%��%�J��%��%��%�P�����%������������%������� �� �� �� �� �*�� �� �� � �����+������������+��������{�}�}��J��J��J��J�$��������r���