관리-도구
편집 파일: _helpers.cpython-311.pyc
� �܋f� � �X � d dl mZ d dlmZmZ d dlmZmZ d dlm Z m Z d d�Zd d�Zd� Z d S )� ��wraps)�PMap�pmap)�PSet�pset)�PVector�pvectorTc �� �� t | � � }|t u s�rBt | t � � r-t �fd�| � � � D � � � � S |t u s�r7t | t � � r"�fd�}t t || � � � � S |t u r"�fd�}t t || � � � � S |t u rt | � � S | S )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) - 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 �8 �� i | ]\ }}|t |�� � ��S � ��freeze��.0�k�v�stricts ��J/opt/cloudlinux/venv/lib64/python3.11/site-packages/pyrsistent/_helpers.py� <dictcomp>zfreeze.<locals>.<dictcomp># s) �� �@�@�@�d�a��Q��q�&�)�)�@�@�@� c �$ �� t | �� � S �Nr ��xr s �r �<lambda>zfreeze.<locals>.<lambda>% � �� �6�!�V�#4�#4� r c �$ �� t | �� � S r r r s �r r zfreeze.<locals>.<lambda>( r r ) �type�dict� isinstancer r �items�listr r �map�tuple�setr )�or �typ�curried_freezes ` r r r s� �� �6 �q�'�'�C� �d�{�{�v�{�*�Q��"5�"5�{��@�@�@�@�a�g�g�i�i�@�@�@�A�A�A� �d�{�{�v�{�*�Q��"8�"8�{�4�4�4�4���s�>�1�-�-�.�.�.� �e�|�|�4�4�4�4���S���+�+�,�,�,� �c�z�z��A�w�w���Hr c �� �� t | � � }t | t � � s�r+|t u r"�fd�}t t || � � � � S t | t � � s�r)|t u r �fd�| � � � D � � S |t u r"�fd�}t t || � � � � S t | t � � rt | � � S | S )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>H � �� ��a���� r c �8 �� i | ]\ }}|t |�� � ��S r r, r s �r r zthaw.<locals>.<dictcomp>K s'