HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/uritemplate/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/uritemplate/__pycache__/variable.cpython-311.pyc
�

��faF2�
���dZddlZddlZddlZejee	e
efZejej
eejeefejeefefZejeefZGd�d��Zdejdejeejej
ejeefffd�Zdejdefd�Zdejdefd	�Zddejdedefd�Zdejd
edefd�ZdS)z�

uritemplate.variable
====================

This module contains the URIVariable class which powers the URITemplate class.

What treasures await you:

- URIVariable class

You see a hammer in front of you.
What do you do?
>

�Nc��eZdZdZdZdZdefd�Zdefd�Zdefd�Z	dd
�Z
dd�Zded
ede
dejedejef
d�Zded
ede
dejedejef
d�Zded
ede
dejedejef
d�Zded
ede
dejedejef
d�Z	ddejedejeeffd�Zd	S)�URIVariableaThis object validates everything inside the URITemplate object.

    It validates template expansions and will truncate length as decided by
    the template.

    Please note that just like the :class:`URITemplate <URITemplate>`, this
    object's ``__str__`` and ``__repr__`` methods do not return the same
    information. Calling ``str(var)`` will return the original variable.

    This object does the majority of the heavy lifting. The ``URITemplate``
    object finds the variables in the URI and then creates ``URIVariable``
    objects.  Expansions of the URI are handled by each ``URIVariable``
    object. ``URIVariable.expand()`` returns a dictionary of the original
    variable and the expanded value. Check that method's documentation for
    more information.

    )
�+�#�.�/�;�?�&�|�!�@z:/?#[]@!$&'()*+,;=�varc��||_d|_d|_g|_g|_i|_|���|���dS)N�)�original�operator�safe�	variables�variable_names�defaults�parse�
post_parse)�selfrs  �6/usr/lib/python3/dist-packages/uritemplate/variable.py�__init__zURIVariable.__init__6sW�� ��
���
���	�
�	
��,.���DF��
��
�
�������������returnc��d|zS)NzURIVariable(%s)��rs r�__repr__zURIVariable.__repr__Is
�� �4�'�'rc��|jS�N)rr!s r�__str__zURIVariable.__str__Ls
���}�rNc��|j}|jdtjvr!|jd|_|jdd�}|jtjdd�vrtj|_|�d��}|D]�}d}|}d|vr&t|�dd����\}}d}|�d��rd	}|dd
�}d}d|vr5t|�dd����\}}t|��}|r
||j
|<|j�|||d�f����d
�|jD��|_
dS)z�Parse the variable.

        This finds the:
            - operator,
            - set of safe characters,
            - variables, and
            - defaults.

        r�N��,�=F�*T����:)�explode�prefixc��g|]\}}|��Sr r )�.0�varname�_s   r�
<listcomp>z%URIVariable.parse.<locals>.<listcomp>zs��J�J�J�<�G�Q�w�J�J�Jr)rr�	operatorsr�reservedr�split�tuple�endswith�intrr�appendr)	r�var_list_str�var_listr�default_val�namer.r/�
prefix_strs	         rrzURIVariable.parseOs~���}���=���{�4�4�4� �M�!�,�D�M��=����,�L��=�K�1�"�1�"�5�5�5�#�,�D�I��%�%�c�*�*���	�	�C��K��D��c�z�z�$)�#�)�)�C��*;�*;�$<�$<�!��k��G��}�}�S�!�!�
!����C�R�C�y��&*�F��d�{�{�#(����C��);�);�#<�#<� ��j��Z�����
2�&1��
�d�#��N�!�!��7�f�=�=�>�
�
�
�
�K�J�4�>�J�J�J����rc��d|_|jx|_|_|jdkrd|_|jdvrd|_|jdkrd|_|jdkrd|_d|_|jdvrtj|_d	Sd	S)
z�Set ``start``, ``join_str`` and ``safe`` attributes.

        After parsing the variable, we need to set up these attributes and it
        only makes sense to do it in a more easily testable way.
        rr)rrrr)rr
r)rrN)rr�start�join_strrr6r!s rrzURIVariable.post_parse|s�����	�%)�]�2��
�T�]��=�C����D�J��=�N�*�*��D�M��=�C����D�J��=�C����D�J��D�M��=�J�&�&�#�,�D�I�I�I�'�&rr?�valuer.r/c�d���|�dSt|��\}}|j�t|��r�|s|sdStjtjt|��}|r'|j���fd�|D����Sd��fd�|D����}��d|��St|��s|r�|sdStjtj
ttf|��}|p t|�
����}|r&|j��fd�|D����Sd��fd�|D����}��d|��S|rBtjtj|��}|r
|d|�n|}��dt|�����S�dzS)z/Expansion method for the '?' and '&' operators.Nc3�B�K�|]}��dt|�����V��dS�r*N��quote�r1�vr?rs  ��r�	<genexpr>z/URIVariable._query_expansion.<locals>.<genexpr>�sJ�����*�*�34�t�.�.�e�A�t�n�n�.�.�*�*�*�*�*�*rr)c3�8�K�|]}t|���V��dSr$rH�r1rKrs  �rrLz/URIVariable._query_expansion.<locals>.<genexpr>��+����� ?� ?�A��q�$��� ?� ?� ?� ?� ?� ?rr*c3�d�K�|]*\}}t|����dt|�����V��+dSrGrH�r1�krKrs   �rrLz/URIVariable._query_expansion.<locals>.<genexpr>�sV�����*�*�=A�Q��u�Q��~�~�8�8��a����8�8�*�*�*�*�*�*rc3�d�K�|]*\}}t|����dt|�����V��+dS)r)NrHrQs   �rrLz/URIVariable._query_expansion.<locals>.<genexpr>�sV�����!�!�=A�Q��u�Q��~�~�8�8��a����8�8�!�!�!�!�!�!r)�is_list_of_tuplesr�	list_test�t�cast�Sequence�ScalarVariableValuerC�join�	dict_test�Mapping�str�sorted�items�TextrI)rr?rDr.r/�tuplesr_rs `     @r�_query_expansionzURIVariable._query_expansion�s<�����=��4�)�%�0�0�
����y���U���
	)�F�
	)��
��t��F�1�:�&9�:�E�B�B�E��
)��}�)�)�*�*�*�*�*�8=�*�*�*������� ?� ?� ?� ?�� ?� ?� ?�?�?���(�(��(�(�(��U���
	)�v�
	)��
��t��F�1�9�S�*=�%=�>��F�F�E��2�V�E�K�K�M�M�2�2�E��
)��}�)�)�*�*�*�*�EJ�*�*�*�������!�!�!�!�EJ�!�!�!�����(�(��(�(�(��	2��F�1�6�5�)�)�E�&,�7�E�'�6�'�N�N�%�E��1�1�U�5�$�/�/�1�1�1��c�z�rc�4�
��|j}|j�|�;t|ttt
tf��st|��dkrdSt|��\}}t|��rW|sU|sd}tjtjt|��}�fd�|D��}|r|�|��ndSt|��s|r�tjtjttf|��}|p t#|�����}d�
|sd�
d}|��
�fd�|D����}	|	r|	ndStjtj|��}|r
|d|�n|}t)|���S)zSLabel and path expansion method.

        Expands for operators: '/', '.'

        Nrr)c�4��g|]}|�t|�����Sr$rHrNs  �rr4z5URIVariable._label_path_expansion.<locals>.<listcomp>�s"���H�H�H�A�!�-��q�$���-�-�-r�%s=%s�%s,%sc3�h�K�|],\}}|��t|���t|���fzV��-dSr$rH)r1rRrK�
format_strrs   ��rrLz4URIVariable._label_path_expansion.<locals>.<genexpr>�sO�����%�%��A�q��=��e�A�t�n�n�e�A�t�n�n�=�=� �=�=�=�%�%r)rCr�
isinstancer]r:�float�complex�lenrTrUrVrWrXrYrZr[r\r^r_r`rI)rr?rDr.r/rCrar_�	fragments�expandedrhrs          @@r�_label_path_expansionz!URIVariable._label_path_expansion�s������=���y���=��5�3��U�G�"<�=�=���E�
�
�a����4�)�%�0�0�
����U���	C�F�	C��
����F�1�:�&9�:�E�B�B�E�H�H�H�H��H�H�H�I�/8�B�8�=�=��+�+�+�d�B��U���
	2�v�
	2��F�1�9�S�*=�%=�>��F�F�E��2�V�E�K�K�M�M�2�2�E� �J��
�$�
����}�}�%�%�%�%�%�!�%�%�%���H�
 (�1�8�8�T�1���q�v�u�%�%��"(�3��g�v�g���e���U�D�!�!�!rc�n��	�|j}|j�	|�dS|jdkrd}t|��\}}t	|��r~|s|tjt
jt|��}|r(|�	��	fd�|D����}|r|ndSd�	�	fd�|D����}��d|��St|��s|r�tjt
jttf|��}|p t|�����}|r!|�	�	fd�|D����Sd�	�	fd	�|D����}��d|��Stjt
j|��}|r
|d|�n|}|r��dt!|�	����S�S)
z"Expansion method for ';' operator.Nr
rc3�F�K�|]}|���dt|�����V��dS�Nr*rHrJs  ��rrLz3URIVariable._semi_path_expansion.<locals>.<genexpr>sB�����)�)�34���t�.�.�e�A�t�n�n�.�.�����)�)rr)c3�8�K�|]}t|���V��dSr$rHrNs  �rrLz3URIVariable._semi_path_expansion.<locals>.<genexpr>
rOrr*c3�h�K�|],\}}|�t|����dt|�����V��-dSrrrHrQs   �rrLz3URIVariable._semi_path_expansion.<locals>.<genexpr>sS�����%�%���1��}��Q��~�~�8�8��a����8�8�$�}�}�}�%�%rc3�h�K�|],\}}|�t|����dt|�����V��-dS)Nr)rHrQs   �rrLz3URIVariable._semi_path_expansion.<locals>.<genexpr>sS�����$�$���1��}��Q��~�~�8�8��a����8�8�$�}�}�}�$�$r)rCrrrTrUrVrWrXrYrZr[r\r]r^r_r`rI)
rr?rDr.r/rCrar_rnrs
 `       @r�_semi_path_expansionz URIVariable._semi_path_expansion�s:�����=���y���=��4��=�C����H�)�%�0�0�
����U���		)�F�		)��F�1�:�&9�:�E�B�B�E��
)�#�=�=�)�)�)�)�)�8=�)�)�)����$,�5�x�x��5���� ?� ?� ?� ?�� ?� ?� ?�?�?���(�(��(�(�(��U���	,�v�	,��F�1�9�S�*=�%=�>��F�F�E��2�V�E�K�K�M�M�2�2�E��
,��}�}�%�%�%�%� %�%�%�%�����8�8�$�$�$�$� %�$�$�$����
�+�+��+�+�+���q�v�u�%�%��"(�3��g�v�g���e���	2��1�1�U�5�$�/�/�1�1�1��rc����|�dSt|��\}}t|��rM|sKtjtjt
|��}d��fd�|D����St|��s|r|tjtjtt
f|��}|p t|�����}|rdnd�d���fd�|D����Stjtj|��}|r
|d|�n|}t|�j��S)Nr)c3�B�K�|]}t|�j��V��dSr$�rIr)r1rKrs  �rrLz0URIVariable._string_expansion.<locals>.<genexpr>7s/�����?�?�A�E�!�T�Y�/�/�?�?�?�?�?�?rrerfc3�x�K�|]4\}}�t|�j��t|�j��fzV��5dSr$ry)r1rRrKrhrs   ��rrLz0URIVariable._string_expansion.<locals>.<genexpr>>s]��������A�q��e�A�t�y�1�1�5��D�I�3F�3F�G�G������r)rTrUrVrWrXrYrZr[r\r]r^r_r`rIr)rr?rDr.r/rar_rhs`      @r�_string_expansionzURIVariable._string_expansion)sU�����=��4�)�%�0�0�
����U���	@�F�	@��F�1�:�&9�:�E�B�B�E��8�8�?�?�?�?��?�?�?�?�?�?��U���	�v�	��F�1�9�S�*=�%=�>��F�F�E��2�V�E�K�K�M�M�2�2�E�$+�8����J��8�8������!������
�
��q�v�u�%�%��"(�3��g�v�g���e���U�D�I�&�&�&r�var_dictc���g}|�|j|jiS|jD]�\}}|�|d��}|s|dkr||jvr
|j|}|��<d}|jdvr|j}n+|jdvr|j}n|jdkr|j}n|j}||||d|d��}|�|�	|����d}|r"|j
|j�|��z}|j|iS)a1Expand the variable in question.

        Using ``var_dict`` and the previously parsed defaults, expand this
        variable and subvariables.

        :param dict var_dict: dictionary of key-value pairs to be used during
            expansion
        :returns: dict(variable=value)

        Examples::

            # (1)
            v = URIVariable('/var')
            expansion = v.expand({'var': 'value'})
            print(expansion)
            # => {'/var': '/value'}

            # (2)
            v = URIVariable('?var,hello,x,y')
            expansion = v.expand({'var': 'value', 'hello': 'Hello World!',
                                  'x': '1024', 'y': '768'})
            print(expansion)
            # => {'?var,hello,x,y':
            #     '?var=value&hello=Hello%20World%21&x=1024&y=768'}

        Nr)rr)r
rr	r.r/)
rr�getrrrorbrvr{r;rBrCrZ)rr|�
return_valuesr?�optsrDrn�	expansions        r�expandzURIVariable.expandGs7��:�
����M�4�=�1�1��.�	/�	/�J�D�$��L�L��t�,�,�E��
,�U�b�[�[�T�T�]�-B�-B��
�d�+���}���H��}�
�*�*� �6�	�	���*�,�,� �1�	�	���#�%�%� �5�	�	� �2�	� �y��u�d�9�o�t�H�~�N�N�H��#��$�$�X�.�.�.�����	C��J���!3�!3�M�!B�!B�B�E��
�u�%�%r)rNr$)�__name__�
__module__�__qualname__�__doc__r5r6r]rr"r%rr�
VariableValue�boolrV�Optionalr:rbrorvr{�VariableValueDictr\r�r rrrrs-��������$C�I�#�H��C�����&(�#�(�(�(�(�������+K�+K�+K�+K�Z-�-�-�-�*-��-��-��	-�
�
�3��-�
��C��
-�-�-�-�^0"��0"��0"��	0"�
�
�3��0"�
��C��
0"�0"�0"�0"�d5��5��5��	5�
�
�3��5�
��C��
5�5�5�5�n'��'��'��	'�
�
�3��'�
��C��
'�'�'�'�>9=�;&�;&��
�#4�5�;&�	
��3��8�	�;&�;&�;&�;&�;&�;&rrrDrc�|�|r5t|ttf��rtd�|D����sdSd|fS)Nc3�fK�|],}t|t��ot|��dkV��-dS)r(N)rir8rl)r1rVs  rrLz$is_list_of_tuples.<locals>.<genexpr>�s;����G�G�A�:�a��'�'�7�C��F�F�a�K�G�G�G�G�G�Gr)FNT)ri�listr8�all�rDs rrTrT�sT��
���%�$���/�/���G�G��G�G�G�G�G��
�{���;�rc�:�t|ttf��Sr$)rir�r8r�s rrUrU�s���e�d�E�]�+�+�+rc�N�t|ttjjf��Sr$)ri�dict�collections�abc�MutableMappingr�s rr[r[�s���e�d�K�O�$B�C�D�D�Dr�utf-8�encodingc�Z�t|t��r|�|��S|Sr$)rir]�encode)rDr�s  r�_encoder��s+���%����&��|�|�H�%�%�%��Lrrc��t|ttf��st|��}tj�t
|��|��Sr$)rir]�bytes�urllibrrIr�)rDrs  rrIrI�sA���e�c�5�\�*�*���E�
�
���<���g�e�n�n�d�3�3�3r)r�)r��collections.abcr��typingrV�urllib.parser��Unionr:rjrkr]rYrXr\�Tupler��Dictr�r�Anyr�r�rTrUr[�AnyStrr�r�rIr rr�<module>r�s����� �������������g�c�5�'�3�6�7�����J�"�#��I�c�&�&�'��G�C�$�$�%����
��F�3�
�-�.��c&�c&�c&�c&�c&�c&�c&�c&�L
��5�
��W�T�1�:�a�j����6I�1I�)J�K�L�
L�M�
�
�
�
�,�Q�U�,�t�,�,�,�,�E�Q�U�E�t�E�E�E�E���1�8��s�������4���4�c�4�c�4�4�4�4�4�4r