HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/pyrsistent/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/pyrsistent/__pycache__/_field_common.cpython-311.pyc
�

���a�.��b�ddlmZmZmZmZmZmZmZmZm	Z	ddlm
ZddlmZddl
Z
d�Zd�Zd�Zd�Zd	�Zd
�ZGd�de��Zd
Zd�Zd�Ze��Zd�Zeeedeefd�Zd�ZGd�de��ZedediZiZ d�Z!d�Z"d�Z#eefd�Z$dd
eefd�Z%dd
eefd�Z&d�Z'iZ(d�Z)d �Z*defd!�Z+dS)"�)	�CheckedPMap�CheckedPSet�CheckedPVector�CheckedType�InvariantException�_restore_pickle�get_type�maybe_parse_user_type�maybe_parse_many_user_types)�optional)�wrap_invariantNc����tt�fd�|D��g����|�<t|�����D](\}}t	|t
��r||�|<||=�)dS)Nc���g|]<}t|j��i���������=S�)�list�__dict__�get�items)�.0�b�names  ��:/usr/lib/python3/dist-packages/pyrsistent/_field_common.py�
<listcomp>zset_fields.<locals>.<listcomp>s=���P�P�P�Q�$�q�z�~�~�d�B�7�7�=�=�?�?�@�@�P�P�P�)�dict�sumrr�
isinstance�_PField)�dct�basesr�k�vs  `  r�
set_fieldsr#s�����S�P�P�P�P�%�P�P�P�RT�U�U�V�V�C��I��S�Y�Y�[�[�!�!�����1��a��!�!�	��C��I�a�L��A����rc�x��td��fd�|D��D����}|rt|dd���dS)Nc3�$K�|]\}}|�|V��dS�Nr)r�is_ok�
error_codes   r�	<genexpr>z*check_global_invariants.<locals>.<genexpr>sH����W�W�'8�u�j�PU�W�
�W�W�W�W�W�Wrc3�.�K�|]}|���V��dSr&r)r�	invariant�subjects  �rr)z*check_global_invariants.<locals>.<genexpr>s-�����H�H�	���7�+�+�H�H�H�H�H�HrrzGlobal invariant failed)�tupler)r,�
invariants�error_codess`  r�check_global_invariantsr0sq����W�W�H�H�H�H�Z�H�H�H�W�W�W�W�W�K��M� ��b�2K�L�L�L�M�Mrc��t|t��r|tur|�|��S|||��Sr&)rr�PFIELD_NO_SERIALIZER�	serialize)�
serializer�format�values   rr3r3!sC���%��%�%�'�*�8L�*L�*L����v�&�&�&��:�f�e�$�$�$rc����|jrht�fd�|jD����sJt���}d�|j||j��}t	|||j||���dSdS)Nc3�R�K�|]!}t�t|����V��"dSr&)rr	)r�tr6s  �rr)zcheck_type.<locals>.<genexpr>)s3�����Q�Q��j������<�<�Q�Q�Q�Q�Q�Qrz'Invalid type for field {0}.{1}, was {2})�type�anyr5�__name__�
PTypeError)�destination_cls�fieldrr6�actual_type�messages   `  r�
check_typerB(s�����z�R�#�Q�Q�Q�Q�e�j�Q�Q�Q�Q�Q�R��5�k�k��;�B�B�?�C[�]a�cn�cw�x�x����$��
�K��Q�Q�Q�R�R�R�Rrc��t|��turdSt|��}t|��dkrdSt	t|d��|��S)NTrF)r:�setr-�len�
issubclassr	)�type_cls�
field_type�typess   r�is_type_clsrJ/sW���J���3����t��*���E�
�5�z�z�Q����u��h�u�Q�x�(�(�(�3�3�3rc�x�|sdSt||j��sdSdtj|j��jvS)NF�ignore_extra)rJr:�inspect�	signature�factory�
parameters)rGr?rLs   r�is_field_ignore_extra_complaintrQ8sC�����u��x���,�,���u��W�.�u�}�=�=�H�H�Hrc�.�eZdZdZd�Zed���ZdS)r�r:r+�initial�	mandatory�_factoryr4c�Z�||_||_||_||_||_||_dSr&rS)�selfr:r+rTrUrOr4s       r�__init__z_PField.__init__Gs0����	�"������"�����
�$����rc���|jtur[t|j��dkrCt	t|j��d��}t
|t��r|jS|jS)N�r)	rV�PFIELD_NO_FACTORYrEr:r	r-rFr�create)rX�typs  rrOz_PField.factoryOsb���=�-�-�-�#�d�i�.�.�A�2E�2E��5���+�+�A�.�/�/�C��#�{�+�+�
"��z�!��}�rN)r<�
__module__�__qualname__�	__slots__rY�propertyrOrrrrrDsC������W�I�%�%�%�����X���rrrc��dS)N)TNr)�_s r�<lambda>reZs���rc��|Sr&r)�xs rrere[s��a�rc��|Sr&r)rdr6s  rrere]s���rFc�Z�t|tttf��rtt	|����}ntt|����}|tkrt|��rt|��n|}t||||||���}t|��|S)a
    Field specification factory for :py:class:`PRecord`.

    :param type: a type or iterable with types that are allowed for this field
    :param invariant: a function specifying an invariant that must hold for the field
    :param initial: value of field if not specified when instantiating the record
    :param mandatory: boolean specifying if the field is mandatory or not
    :param factory: function called when field is set.
    :param serializer: function that returns a serialized version of the field
    )r:r+rTrUrOr4)rrrDr-rr
�PFIELD_NO_INVARIANT�callabler
r�_check_field_parameters)	r:r+rTrUrOr4rI�invariant_functionr?s	         rr?r?`s���,�$��s�E�*�+�+�1��/��5�5�6�6����)�$�/�/�0�0��6?�CV�6V�6V�[c�dm�[n�[n�6V��	�2�2�2�t}����*<�g�'��Z�
Q�
Q�
Q�E��E�"�"�"��Lrc����jD][}t|t��sDt|t��s/td�t|��������\�jturot�j��s[�jrTt�fd��jD����s4td�t�j�������t�j	��std���t�j
��std���t�j��std���dS)Nz Type parameter expected, not {0}c3�B�K�|]}t�j|��V��dSr&)rrT)rr9r?s  �rr)z*_check_field_parameters.<locals>.<genexpr>�s/�����"T�"T�A�:�e�m�Q�#?�#?�"T�"T�"T�"T�"T�"TrzInitial has invalid type {0}zInvariant must be callablezFactory must be callablezSerializer must be callable)r:r�str�	TypeErrorr5rT�PFIELD_NO_INITIALrkr;r+rOr4)r?r9s` rrlrl�sG���
�Z�P�P���!�T�"�"�	P�:�a��+=�+=�	P��>�E�E�d�1�g�g�N�N�O�O�O���}�-�-�-����'�'�.��J�.�"�"T�"T�"T�"T���"T�"T�"T�T�T�.��6�=�=�d�5�=�>Q�>Q�R�R�S�S�S��E�O�$�$�6��4�5�5�5��E�M�"�"�4��2�3�3�3��E�$�%�%�7��5�6�6�6�7�7rc�"��eZdZdZ�fd�Z�xZS)r=a
    Raised when trying to assign a value with a type that doesn't match the declared type.

    Attributes:
    source_class -- The class of the record
    field -- Field name
    expected_types  -- Types allowed for the field
    actual_type -- The non matching type
    c���tt|��j|i|��||_||_||_||_dSr&)�superr=rY�source_classr?�expected_typesr@)rXrvr?rwr@�args�kwargs�	__class__s       �rrYzPTypeError.__init__�sJ���(��j�$���(�$�9�&�9�9�9�(�����
�,���&����r)r<r_r`�__doc__rY�
__classcell__)rzs@rr=r=�sB���������'�'�'�'�'�'�'�'�'rr=�PVector�PSetc�@�t||f}t||��S)z=Unpickling function for auto-generated PVec/PSet field types.)�_seq_field_typesr)�
checked_class�	item_type�data�type_s    r�_restore_seq_field_pickler��s!���]�I�5�6�E��5�$�'�'�'rc�@�d�d�|D����S)z4Convert a tuple of types to a human-readable string.�c3�bK�|]*}t|��j���V��+dSr&)r	r<�
capitalize)rr^s  rr)z"_types_to_names.<locals>.<genexpr>�s7����H�H�3�8�C�=�=�)�4�4�6�6�H�H�H�H�H�Hr)�join)rIs r�_types_to_namesr��s#��
�7�7�H�H�%�H�H�H�H�H�Hrc������t���f��}|�|SG���fd�d���}t�}t|j��|z|_|t��f<|S)zFCreate a subclass of the given checked class with the given item type.Nc�$��eZdZ�Z�Z��fd�ZdS)�%_make_seq_field_type.<locals>.TheTypec�6��t��t|��ffSr&)r�r)rXr�r�s ��r�
__reduce__z0_make_seq_field_type.<locals>.TheType.__reduce__�s ���-�"�I�t�D�z�z�:�<�
<rN)r<r_r`�__type__�
__invariant__r�)r��item_invariantr�s���r�TheTyper��s=���������&�
�	<�	<�	<�	<�	<�	<�	<�	<rr�)r�r�SEQ_FIELD_TYPE_SUFFIXESr��_checked_typesr<)r�r�r�r�r��suffixs```   r�_make_seq_field_typer��s������� � �-��!;�<�<�E�����<�<�<�<�<�<�<�<�<�-�<�<�<�%�]�
3�F�&�w�'=�>�>��G�G��18��]�I�-�.��Nrc	���t|||���|rd�fd�	}n�j}t|rt���n�|d|||�����S)a�
    Create checked field for either ``PSet`` or ``PVector``.

    :param checked_class: ``CheckedPSet`` or ``CheckedPVector``.
    :param item_type: The required type for the items in the set.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory.

    :return: A ``field`` containing a checked class.
    NFc�<��|�dS��|||���S)N)�_factory_fieldsrL�r])�argumentr�rLr�s   �rrOz _sequence_field.<locals>.factory�s'������t��~�~�h��^j�~�k�k�krT)r:rOrUr+rT)NF)r�r]r?�
optional_type)r�r�rrTr+r�rOr�s       @r�_sequence_fieldr��s����#�=�)�^�L�L�G��!�	l�	l�	l�	l�	l�	l�	l��.����E�m�G�,�,�,�g� �D�$� ���)�)�+�+�+�+rc�6�tt|||||���S)al
    Create checked ``PSet`` field.

    :param item_type: The required type for the items in the set.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory if no value is given
        for the field.

    :return: A ``field`` containing a ``CheckedPSet`` of the given type.
    �r+r�)r�r�r�rrTr+r�s     r�
pset_fieldr��s)���;�	�8�W�%.�*8�:�:�:�:rc�6�tt|||||���S)au
    Create checked ``PVector`` field.

    :param item_type: The required type for the items in the vector.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param initial: Initial value to pass to factory if no value is given
        for the field.

    :return: A ``field`` containing a ``CheckedPVector`` of the given type.
    r�)r�rr�s     r�
pvector_fieldr�s)���>�9�h��%.�*8�:�:�:�:rc��dS)N)Tr�r)�items rreres��j�rc�@�t||f}t||��S)z8Unpickling function for auto-generated PMap field types.)�_pmap_field_typesr)�key_type�
value_typer�r�s    r�_restore_pmap_field_pickler�s!���h�
�2�3�E��5�$�'�'�'rc����t���f��}|�|SG��fd�dt��}d�t	|j��t	|j����|_|t��f<|S)zDCreate a subclass of CheckedPMap with the given key and value types.Nc���eZdZ�Z�Zd�ZdS)�%_make_pmap_field_type.<locals>.TheMapc�H�t|j|jt|��ffSr&)r��__key_type__�__value_type__r)rXs rr�z0_make_pmap_field_type.<locals>.TheMap.__reduce__(s'��.��&��(;�T�$�Z�Z�H�J�
JrN)r<r_r`r�r�r�)r�r�s��r�TheMapr�$s3���������#��	J�	J�	J�	J�	Jrr�z{0}To{1}PMap)r�rrr5r��_checked_key_types�_checked_value_typesr<)r�r�r�r�s``  r�_make_pmap_field_typer�s������!�!�8�Z�"8�9�9�E�����J�J�J�J�J�J�J�J��J�J�J�%�+�+���1�2�2���3�4�4�6�6�F�O�/5��h�
�*�+��Mrc���t||���|r�fd�}n�j}td���|rt���n�||���S)ad
    Create a checked ``PMap`` field.

    :param key: The required type for the keys of the map.
    :param value: The required type for the values of the map.
    :param optional: If true, ``None`` can be used as a value for
        this field.
    :param invariant: Pass-through to ``field``.

    :return: A ``field`` containing a ``CheckedPMap``.
    c�6��|�dS��|��Sr&r�)r�r�s �rrOzpmap_field.<locals>.factoryBs ������t��}�}�X�.�.�.rT)rUrTr:rOr+)r�r]r?r�)r�r�rr+rOr�s     @r�
pmap_fieldr�3s~���#�8�Z�
8�
8�F�� �	/�	/�	/�	/�	/�	/��-���4�����/7�C�m�F�+�+�+�V� �I�7�7�7�7r),�pyrsistent._checked_typesrrrrrrr	r
rrr�r
rMr#r0r3rBrJrQ�objectr�PFIELD_NO_TYPErjr\rrr2r?rlrqr=r�r�r�r�r�r�r�r��_validr�r�r�r�rrr�<module>r�s���
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�@�?�?�?�?�?�4�4�4�4�4�4��������M�M�M�%�%�%�R�R�R�4�4�4�I�I�I������f����*��,�,���K���F�H�H��-�-���)<�FW��#4�AU�!�!�!�!�H7�7�7�('�'�'�'�'��'�'�'�&�I�������(�(�(�
I�I�I����(2�#6�+�+�+�+�>$)�"�,�1�:�:�:�:�&',�R�/�!4�:�:�:�:�&
!�	 ����(�(�(�
���*/4�?R�7�7�7�7�7�7r