Ë
    ûûàg¦  ã                   óÒ   — d Z ddlZddlZddlmZ ddlmZ  ej                  d«      Zdej                  ej                     dej                  dej                  fd	„Z G d
„ d«      Zy)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                 óP   — | r#| j                  «       }|j                  |«       |S |S ©N)ÚcopyÚupdate)r   r   Úoptss      úR/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/uritemplate/template.pyÚ_merger      s)   € ñ Ø�}‰}‹ˆØ�‰�IÔØˆØÐó    c                   ó,  — e Zd ZdZdefd„Zdefd„Zdefd„Zdede	fd„Z
defd	„Zd
ej                  de	defd„Z	 dd
ej"                  ej                     dej$                  defd„Z	 dd
ej"                  ej                     dej$                  dd fd„Zy)Ú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                 ót  — || _         t        j                  | j                   «      D �cg c](  }t        j                  |j                  «       d   «      ‘Œ* c}| _        t        j                  «       | _	        | j                  D ].  }|j                  D ]  }| j                  j                  |«       Œ Œ0 y c c}w )Nr   )r   Útemplate_reÚfinditerr   ÚURIVariableÚgroupsÚ	variablesr   Ú
OrderedSetÚvariable_namesÚadd)Úselfr   ÚmÚvarÚnames        r   Ú__init__zURITemplate.__init__F   s�   € àˆŒô
 !×)Ñ)¨$¯(©(Ó3ö8
àô × Ñ  §¡£¨A¡Õ/ò8
ˆŒô
 )×3Ñ3Ó5ˆÔØ—>‘>ò 	.ˆCØ×*Ñ*ò .�Ø×#Ñ#×'Ñ'¨Õ-ñ.ñ	.ùò8
s   ©-B5r   c                 ó   — d| z  S )NzURITemplate("%s")© ©r   s    r   Ú__repr__zURITemplate.__repr__U   s   € Ø" TÑ)Ð)r   c                 ó   — | j                   S r	   )r   r#   s    r   Ú__str__zURITemplate.__str__X   s   € Ø�x‰xˆr   Úotherc                 ó`   — t        |t        «      st        S | j                  |j                  k(  S r	   )Ú
isinstancer   ÚNotImplementedr   )r   r'   s     r   Ú__eq__zURITemplate.__eq__[   s%   € Ü˜%¤Ô-Ü!Ð!Ø�x‰x˜5Ÿ9™9Ñ$Ð$r   c                 ó,   — t        | j                  «      S r	   )Úhashr   r#   s    r   Ú__hash__zURITemplate.__hash__`   s   € Ü�D—H‘H‹~Ðr   r   Úreplacec                 ó"  ‡— | j                   s| j                  S |}i Š| j                   D ]"  }‰j                  |j                  |«      «       Œ$ dddt        fˆfd„}dddt        fˆfd„}|r|n|}t
        j                  || j                  «      S )NÚmatchzre.Match[str]r   c                 óJ   •— ‰j                  | j                  «       d   d«      S )Nr   Ú )Úgetr   )r1   Úexpandeds    €r   Úreplace_allz(URITemplate._expand.<locals>.replace_alln   s   ø€ Ø—<‘< §¡£¨qÑ 1°2Ó6Ð6r   c                 ó^   •— | j                  «       d   }d|z  }‰j                  |«      xs |S )Nr   z{%s})r   r4   )r1   Úmatch_groupr   r5   s      €r   Úreplace_partialz,URITemplate._expand.<locals>.replace_partialq   s1   ø€ ØŸ,™,›.¨Ñ+ˆKØ˜;Ñ&ˆCØ—<‘< Ó,Ò3°Ð3r   )r   r   r   ÚexpandÚstrr   Úsub)	r   r   r/   Ú	expansionÚvr6   r9   Úreplace_funcr5   s	           @r   Ú_expandzURITemplate._expandc   s�   ø€ ð �~Š~Ø—8‘8ˆOàˆ	Ø%'ˆØ—‘ò 	1ˆAØ�O‰O˜AŸH™H YÓ/Õ0ð	1ð	7˜ð 	7´3õ 	7ð	4 ?ð 	4´sõ 	4ñ
 +2‘°{ˆä�‰˜|¨T¯X©XÓ6Ð6r   NÚkwargsc                 ó:   — | j                  t        ||«      d«      S )am  Expand 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)r@   r   ©r   r   rA   s      r   r:   zURITemplate.expandz   s   € ð2 �|‰|œF 8¨VÓ4°eÓ<Ð<r   c                 óL   — t        | j                  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)r   r@   r   rC   s      r   ÚpartialzURITemplate.partial•   s!   € ô( ˜4Ÿ<™<¬¨x¸Ó(@À$ÓGÓHÐHr   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r;   r    r$   r&   ÚobjectÚboolr+   Úintr.   r   ÚVariableValueDictr@   ÚtÚOptionalÚVariableValuer:   rE   r"   r   r   r   r   %   sé   „ ñð>.˜Có .ð*˜#ó *ð˜ó ð%˜Fð % tó %ð
˜#ó ð7Ø ×2Ñ2ð7Ø=Að7à	ó7ð2 <@ñ=à—*‘*˜X×7Ñ7Ñ8ð=ð ×(Ñ(ð=ð 
ó	=ð: <@ñIà—*‘*˜X×7Ñ7Ñ8ðIð ×(Ñ(ðIð 
ô	Ir   r   )rI   ÚreÚtypingrN   Úuritemplater   r   Úcompiler   rO   rM   r   r   r"   r   r   ú<module>rU      sp   ðñó  
Û å "Ý  àˆb�j‰j˜Ó%€ðØ�j‰j˜×3Ñ3Ñ4ðà×)Ñ)ðð ×Ñó÷DIò DIr   