%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__/_helpers.cpython-312.pyc

�

n�9e�
��^�ddlZddlmZddlmZmZddlmZmZddl	m
Z
mZd	d�Zd	d�Z
d�Zy)
�N��wraps)�PMap�pmap)�PSet�pset)�PVector�pvectorc�`��t|�}|tus�rGt|t�r7t	|j�D��cic]\}}|t
|����c}}�S|tjus�rGt|t�r7t	|j�D��cic]\}}|t
|����c}}�S|tus�r*t|t�r�fd�}tt||��S|tur�fd�}tt||��S|turt|�S|Scc}}wcc}}w)a�
    Recursively convert simple Python containers into pyrsistent versions
    of those containers.

    - list is converted to pvector, recursively
    - dict is converted to pmap, recursively on values (but not keys)
    - defaultdict is converted to pmap, recursively on values (but not keys)
    - set is converted to pset, but not recursively
    - tuple is converted to tuple, recursively.

    If strict == True (default):

    - freeze is called on elements of pvectors
    - freeze is called on values of pmaps

    Sets and dict keys are not recursively frozen because they do not contain
    mutable data by convention. The main exception to this rule is that
    dict keys and set elements are often instances of mutable objects that
    support hash-by-id, which this function can't convert anyway.

    >>> freeze(set([1, 2]))
    pset([1, 2])
    >>> freeze([1, {'a': 3}])
    pvector([1, pmap({'a': 3})])
    >>> freeze((1, []))
    (1, pvector([]))
    c���t|��S�N��freeze��x�stricts ��5/usr/lib/python3/dist-packages/pyrsistent/_helpers.py�<lambda>zfreeze.<locals>.<lambda>)����6�!�V�#4��c���t|��Sr
rrs �rrzfreeze.<locals>.<lambda>,rr)�type�dict�
isinstancerr�itemsr�collections�defaultdict�listr	r
�map�tuple�setr)�or�typ�k�v�curried_freezes `    rrrs����8�q�'�C�
�d�{�v�*�Q��"5��a�g�g�i�@�d�a��Q��q�&�)�)�@�A�A�
�k�%�%�%�&�Z��4�5H��a�g�g�i�@�d�a��Q��q�&�)�)�@�A�A�
�d�{�v�*�Q��"8�4���s�>�1�-�.�.�
�e�|�4���S���+�,�,�
�c�z��A�w���H��A��@s�D$
�D*
c	���t|�}t|t�s
�r"|tur�fd�}tt	||��St|t
�s
�r6|tur.|j�D��cic]\}}|t|����c}}S|tur�fd�}tt	||��St|t�rt|�S|Scc}}w)a?
    Recursively convert pyrsistent containers into simple Python containers.

    - pvector is converted to list, recursively
    - pmap is converted to dict, recursively on values (but not keys)
    - pset is converted to set, but not recursively
    - tuple is converted to tuple, recursively.

    If strict == True (the default):

    - thaw is called on elements of lists
    - thaw is called on values in dicts

    >>> from pyrsistent import s, m, v
    >>> thaw(s(1, 2))
    {1, 2}
    >>> thaw(v(1, m(a=3)))
    [1, {'a': 3}]
    >>> thaw((1, v()))
    (1, [])
    c���t|��Sr
��thawrs �rrzthaw.<locals>.<lambda>L�
����a���rc���t|��Sr
r)rs �rrzthaw.<locals>.<lambda>Qr+r)rrr	rrrrrr*r rr!)r"rr#�curried_thawr$r%s `    rr*r*4s����,�q�'�C��!�W��&�S�D�[�0���C��a�(�)�)��!�T��v�#��+�/0�w�w�y�9�t�q�!��4��6�?�"�9�9�
�e�|�0���S��q�)�*�*��!�T���1�v�
��H��:s�.Cc�.��t���fd��}|S)a
    Convenience decorator to isolate mutation to within the decorated function (with respect
    to the input arguments).

    All arguments to the decorated function will be frozen so that they are guaranteed not to change.
    The return value is also frozen.
    c���t�|D�cgc]
}t|���c}itd�|j�D�����Scc}w)Nc3�2K�|]}t|����y�wr
r)�.0�items  r�	<genexpr>z*mutant.<locals>.inner_f.<locals>.<genexpr>cs����;d�T�F�4�L�;d�s�)rrr)�args�kwargs�e�fns   �r�inner_fzmutant.<locals>.inner_fas?����b�d�3��6�!�9�3�e�t�;d�U[�Ua�Ua�Uc�;d�7d�e�f�f��3s�Ar)r7r8s` r�mutantr9Ys$����2�Y�g��g��Nr)T)r�	functoolsr�pyrsistent._pmaprr�pyrsistent._psetrr�pyrsistent._pvectorr	r
rr*r9�rr�<module>r?s%����'�'�0�*
�Z"
�Jr

Zerion Mini Shell 1.0