%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/pyrsistent/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/pyrsistent/__pycache__/_pset.cpython-312.pyc

�

n�9e�����ddlmZmZddlZddlmZmZddlmZedd��Z	Gd�d	ee	�Z
eje
�eje
�e
e��Zdd
�Z
d�Zy)
�)�Set�HashableN)�TypeVar�Generic)�pmap�T_coT)�	covariantc���eZdZdZdZ�fd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Ze
dd��Zd�Zd
�Zd�Zd�ZGd�de�Zd�Zd�Zej0Zej2Zej4Zej6Zej8Zej:Zej<Zej>Zej@Z ejBZ!eZ"eZ#eZ$eZ%e Z&e!Z'ejPZ(�xZ)S)�PSeta!
    Persistent set implementation. Built on top of the persistent map. The set supports all operations
    in the Set protocol and is Hashable.

    Do not instantiate directly, instead use the factory functions :py:func:`s` or :py:func:`pset`
    to create an instance.

    Random access and insert is log32(n) where n is the size of the set.

    Some examples:

    >>> s = pset([1, 2, 3, 1])
    >>> s2 = s.add(4)
    >>> s3 = s2.remove(2)
    >>> s
    pset([1, 2, 3])
    >>> s2
    pset([1, 2, 3, 4])
    >>> s3
    pset([1, 3, 4])
    )�_map�__weakref__c�<��tt|�|�}||_|S�N)�superr�__new__r)�cls�m�self�	__class__s   ��2/usr/lib/python3/dist-packages/pyrsistent/_pset.pyrzPSet.__new__!s ����T�3�'��,����	���c��||jvSr)r�r�elements  r�__contains__zPSet.__contains__&s���$�)�)�#�#rc�,�t|j�Sr)�iterr�rs r�__iter__z
PSet.__iter__)����D�I�I��rc�,�t|j�Sr)�lenrrs r�__len__zPSet.__len__,s���4�9�9�~�rc��|sdtt|��zSdjtt|��dd�S)N�pzpset([{0}])����)�str�set�formatrs r�__repr__z
PSet.__repr__/s8�����S��Y��'�'��#�#�C��D�	�N�1�R�$8�9�9rc�"�|j�Sr)r+rs r�__str__zPSet.__str__5s���}�}��rc�,�t|j�Sr)�hashrrs r�__hash__z
PSet.__hash__8r rc�&�tt|�ffSr)�pset�listrs r�
__reduce__zPSet.__reduce__;s���d�4�j�]�"�"rc�N�tttd�|D��|���S)Nc3�$K�|]}|df���
y�w)TN�)�.0�ks  r�	<genexpr>z&PSet._from_iterable.<locals>.<genexpr>As����4�A�q�$�i�4�s���pre_size)rr�dict)r�itr<s   r�_from_iterablezPSet._from_iterable?s���D��4��4�4�x�H�I�Irc�\�|j�j|�j�S)z~
        Return a new PSet with element added

        >>> s1 = s(1, 2)
        >>> s1.add(3)
        pset([1, 2, 3])
        ��evolver�add�
persistentrs  rrCzPSet.addCs$���|�|�~�!�!�'�*�5�5�7�7rc�r�|j�}|D]}|j|��|j�S)z�
        Return a new PSet with elements in iterable added

        >>> s1 = s(1, 2)
        >>> s1.update([3, 4, 4])
        pset([1, 2, 3, 4])
        rA)r�iterable�ers    r�updatezPSet.updateMs7��
�L�L�N���	�G�
�E�E�'�N�	��|�|�~�rc��||jvr-|j�j|�j�St	dt|�z��)z�
        Return a new PSet with element removed. Raises KeyError if element is not present.

        >>> s1 = s(1, 2)
        >>> s1.remove(2)
        pset([1])
        z Element '%s' not present in PSet)rrB�removerD�KeyError�reprrs  rrJzPSet.remove[sE���d�i�i���<�<�>�(�(��1�<�<�>�>��9�D��M�I�J�Jrc�|�||jvr-|j�j|�j�S|S)zc
        Return a new PSet with element removed. Returns itself if element is not present.
        )rrBrJrDrs  r�discardzPSet.discardhs5���d�i�i���<�<�>�(�(��1�<�<�>�>��rc�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�
PSet._Evolver)�_original_pset�
_pmap_evolverc�P�||_|jj�|_yr)rQrrBrR)r�
original_psets  r�__init__zPSet._Evolver.__init__ts!��"/�D��!.�!3�!3�!;�!;�!=�D�rc�$�d|j|<|S)NT�rRrs  rrCzPSet._Evolver.addxs��*.�D���w�'��Krc� �|j|=|SrrWrs  rrJzPSet._Evolver.remove|s���"�"�7�+��Krc�6�|jj�Sr)rR�is_dirtyrs rrZzPSet._Evolver.is_dirty�s���%�%�.�.�0�0rc��|j�s|jSt|jj	��Sr)rZrQrrRrDrs rrDzPSet._Evolver.persistent�s1���=�=�?��+�+�+���*�*�5�5�7�8�8rc�,�t|j�Sr)r"rRrs rr#zPSet._Evolver.__len__�s���t�)�)�*�*rN)
�__name__�
__module__�__qualname__�	__slots__rUrCrJrZrDr#r7rr�_EvolverrPqs%��7�	�	>�	�	�	1�	9�	+rrac��|Srr7rs r�copyz	PSet.copy�s���rc�,�tj|�S)a!
        Create a new evolver for this pset. For a discussion on evolvers in general see the
        documentation for the pvector evolver.

        Create the evolver and perform various mutating updates to it:

        >>> s1 = s(1, 2, 3)
        >>> e = s1.evolver()
        >>> _ = e.add(4)
        >>> len(e)
        4
        >>> _ = e.remove(1)

        The underlying pset remains the same:

        >>> s1
        pset([1, 2, 3])

        The changes are kept in the evolver. An updated pmap can be created using the
        persistent() function on the evolver.

        >>> s2 = e.persistent()
        >>> s2
        pset([2, 3, 4])

        The new pset will share data with the original pset in the same way that would have
        been done if only using operations on the pset.
        )rrars rrBzPSet.evolver�s��:�}�}�T�"�"r)�)*r]r^r_�__doc__r`rrrr#r+r-r0r4�classmethodr?rCrHrJrN�objectrarcrBr�__le__�__lt__�__gt__�__ge__�__eq__�__ne__�__and__�__or__�__sub__�__xor__�issubset�
issuperset�union�intersection�
difference�symmetric_difference�
isdisjoint�
__classcell__)rs@rrr	s�����*(�I��
$���:���#��J��J�8��K��+�6�+�6�#�F�Z�Z�F�
�Z�Z�F�
�Z�Z�F�
�Z�Z�F�
�Z�Z�F�
�Z�Z�F��k�k�G�
�Z�Z�F��k�k�G��k�k�G��H��J��E��L��J�"�����Jrrc�@�|stStj||��S)z�
    Creates a persistent set from iterable. Optionally takes a sizing parameter equivalent to that
    used for :py:func:`pmap`.

    >>> s1 = pset([1, 2, 3, 2])
    >>> s1
    pset([1, 2, 3])
    r;)�_EMPTY_PSETrr?)rFr<s  rr2r2�s#��������x�(��;�;rc��t|�S)z�
    Create a persistent set.

    Takes an arbitrary number of arguments to insert into the new set.

    >>> s1 = s(1, 2, 3, 2)
    >>> s1
    pset([1, 2, 3])
    )r2)�elementss r�sr�s����>�r)r7re)�collections.abcrr�sys�typingrr�pyrsistent._pmaprrr�registerr|r2rr7rr�<module>r�se��)�
�#�!��v��&��| �7�4�=�| �|
����T������$���4�6�l��<�
r

Zerion Mini Shell 1.0