§
    ¡”j¦  ã                   ó´   — 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dS )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)r   r   Úoptss      úc/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/uritemplate/template.pyÚ_merger      s6   € ð ð Ø�}Š}‰ŒˆØ�Š�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d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        ¦   «         | _        | j        D ]&}|j        D ]}| j                             |¦  «         ŒŒ'd S )Nc                 óf   — g | ].}t          j        |                     ¦   «         d          ¦  «        ‘Œ/S )r   )r   ÚURIVariableÚgroups)Ú.0Úms     r   ú
<listcomp>z(URITemplate.__init__.<locals>.<listcomp>K   s?   € ð 8
ð 8
ð 8
àõ Ô  §¢¡¤¨A¤Ñ/Ô/ð8
ð 8
ð 8
r   )r   Útemplate_reÚfinditerÚ	variablesr   Ú
OrderedSetÚvariable_namesÚadd)Úselfr   ÚvarÚnames       r   Ú__init__zURITemplate.__init__F   s˜   € àˆŒð8
ð 8
å ×)Ò)¨$¬(Ñ3Ô3ð8
ñ 8
ô 8
ˆŒõ
 )Ô3Ñ5Ô5ˆÔØ”>ð 	.ð 	.ˆCØÔ*ð .ð .�ØÔ#×'Ò'¨Ñ-Ô-Ð-Ð-ð.ð	.ð 	.r   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ˆr   Úotherc                 óZ   — t          |t          ¦  «        st          S | j        |j        k    S r	   )Ú
isinstancer   ÚNotImplementedr   )r    r*   s     r   Ú__eq__zURITemplate.__eq__[   s)   € Ý˜%¥Ñ-Ô-ð 	"Ý!Ð!ØŒx˜5œ9Ò$Ð$r   c                 ó*   — t          | j        ¦  «        S r	   )Úhashr   r&   s    r   Ú__hash__zURITemplate.__hash__`   s   € Ý�D”H‰~Œ~Ðr   r   Úreplacec                 ó  ‡— | j         s| j        S |}i Š| j         D ]*}‰                     |                     |¦  «        ¦  «         Œ+dddt          fˆfd„}dddt          fˆfd„}|r|n|}t
                               || j        ¦  «        S )NÚmatchzre.Match[str]r   c                 ó`   •— ‰                      |                      ¦   «         d         d¦  «        S )Nr   Ú )Úgetr   )r4   Úexpandeds    €r   Úreplace_allz(URITemplate._expand.<locals>.replace_alln   s$   ø€ Ø—<’< §¢¡¤¨qÔ 1°2Ñ6Ô6Ð6r   c                 óp   •— |                       ¦   «         d         }d|z  }‰                     |¦  «        p|S )Nr   z{%s})r   r7   )r4   Úmatch_groupr!   r8   s      €r   Úreplace_partialz,URITemplate._expand.<locals>.replace_partialq   s6   ø€ ØŸ,š,™.œ.¨Ô+ˆKØ˜;Ñ&ˆCØ—<’< Ñ,Ô,Ð3°Ð3r   )r   r   r   ÚexpandÚstrr   Úsub)	r    r   r2   Ú	expansionÚvr9   r<   Úreplace_funcr8   s	           @r   Ú_expandzURITemplate._expandc   sÐ   ø€ ð Œ~ð 	Ø”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Ð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)rC   r   ©r    r   rD   s      r   r=   zURITemplate.expandz   s"   € ð2 �|Š|�F 8¨VÑ4Ô4°eÑ<Ô<Ð<r   c                 ó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)r   rC   r   rF   s      r   ÚpartialzURITemplate.partial•   s*   € õ( ˜4Ÿ<š<­¨x¸Ñ(@Ô(@À$ÑGÔGÑHÔHÐHr   r	   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r>   r#   r'   r)   ÚobjectÚboolr.   Úintr1   r   ÚVariableValueDictrC   ÚtÚOptionalÚVariableValuer=   rH   r%   r   r   r   r   &   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ð Ir   r   )rL   ÚreÚtypingrQ   Úuritemplater   r   Úcompiler   rR   rP   r   r   r%   r   r   ú<module>rX      sß   ððð ð" 
€	€	€	Ø Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ø  Ð  Ð  Ð  Ð  Ð  àˆbŒj˜Ñ%Ô%€ðØŒj˜Ô3Ô4ðàÔ)ðð Ôðð ð ð ðCIð CIð CIð CIð CIñ CIô CIð CIð CIð CIr   