%PDF- %PDF-
Direktori : /lib/python3/dist-packages/pyrsistent/__pycache__/ |
Current File : //lib/python3/dist-packages/pyrsistent/__pycache__/_helpers.cpython-312.pyc |
� n�9e� � �^ � d dl Z d dlmZ d dlmZmZ d dlmZmZ d dl m Z mZ d d�Zd d�Z d� Zy) � N��wraps)�PMap�pmap)�PSet�pset)�PVector�pvectorc �` �� t | � }|t u s�rGt | t � r7t | j � D ��ci c] \ }}|t |�� �� c}}� S |t j u s�rGt | t � r7t | j � D ��ci c] \ }}|t |�� �� c}}� S |t u s�r*t | t � r�fd�}t t || � � S |t u r�fd�}t t || � � S |t u rt | � S | S c c}}w c c}}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 | �� S r r r s �r r zfreeze.<locals>.<lambda>, r r )�type�dict� isinstancer r �itemsr �collections�defaultdict�listr r �map�tuple�setr )�or �typ�k�v�curried_freezes ` r r r s� �� �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"|t u r�fd�}t t || � � S t | t � s �r6|t u r.| j � D ��ci c] \ }}|t |�� �� c}}S |t u r�fd�}t t || � � S t | t � rt | � S | S c c}}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 | �� S r ��thawr s �r r zthaw.<locals>.<lambda>L � �� ��a��� r c � �� t | �� S r r) r s �r r zthaw.<locals>.<lambda>Q r+ r )r r r r r r r r r* r r r! )r"