Ë
    ûûàgF2  ã            
       ó&  — d Z ddlZddlZddlZej                  ee	e
ef   Zej                  ej                  e   ej                  eef   ej                  eef   ef   Zej"                  eef   Z G d„ d«      Zdej(                  dej                  eej,                  ej                  ej                  eef         f   fd„Zdej(                  defd„Zdej(                  defd	„Zddej4                  d
edefd„Zdej(                  dedefd„Zy)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                   óØ  — e Zd ZdZdZdZdefd„Zdefd„Zdefd„Z	dd
„Z
dd„Zdedededej                  e   dej                  e   f
d„Zdedededej                  e   dej                  e   f
d„Zdedededej                  e   dej                  e   f
d„Zdedededej                  e   dej                  e   f
d„Z	 ddej                  e   dej,                  eef   fd„Zy	)ÚURIVariablea  This 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 | _        | j                  «        | j                  «        y )NÚ )ÚoriginalÚoperatorÚsafeÚ	variablesÚvariable_namesÚdefaultsÚparseÚ
post_parse)Úselfr   s     úR/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/uritemplate/variable.pyÚ__init__zURIVariable.__init__6   sG   € à ˆŒàˆŒàˆŒ	ð ð 	Œð ,.ˆÔàDFˆŒà�
‰
ŒØ�‰Õó    Úreturnc                 ó   — d| z  S )NzURIVariable(%s)© ©r   s    r   Ú__repr__zURIVariable.__repr__I   s   € Ø  4Ñ'Ð'r   c                 ó   — | j                   S ©N)r   r!   s    r   Ú__str__zURIVariable.__str__L   s   € Ø�}‰}Ðr   Nc                 óÌ  — | j                   }| j                   d   t        j                  v r#| j                   d   | _        | j                   dd }| j                  t        j                  dd v rt        j                  | _        |j                  d«      }|D ]¢  }d}|}d|v rt        |j                  dd«      «      \  }}d}|j                  d«      rd	}|dd
 }d}d|v r)t        |j                  dd«      «      \  }}t        |«      }|r|| j                  |<   | j                  j                  |||dœf«       Œ¤ | j                  D �	�
cg c]  \  }	}
|	‘Œ	 c}
}	| _        yc c}
}	w )z©Parse the variable.

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

        r   é   Né   ú,ú=FÚ*Téÿÿÿÿú:)ÚexplodeÚprefix)r   r   Ú	operatorsr   Úreservedr   ÚsplitÚtupleÚendswithÚintr   r   Úappendr   )r   Úvar_list_strÚvar_listr   Údefault_valÚnamer.   r/   Ú
prefix_strÚvarnameÚ_s              r   r   zURIVariable.parseO   sU  € ð —}‘}ˆØ�=‰=˜Ñœ{×4Ñ4Ñ4Ø ŸM™M¨!Ñ,ˆDŒMØŸ=™=¨¨Ð,ˆLà�=‰=œK×1Ñ1°"°1Ð5Ñ5Ü#×,Ñ,ˆDŒIà×%Ñ% cÓ*ˆàò 	ˆCØˆKØˆDØ�c‰zÜ$)¨#¯)©)°C¸Ó*;Ó$<Ñ!��kàˆGØ�}‰}˜SÔ!Ø�Ø˜C˜R�y�à&*ˆFØ�d‰{Ü#(¨¯©°C¸Ó);Ó#<Ñ ��jÜ˜Z›�áØ&1�—‘˜dÑ#à�N‰N×!Ñ!Ø 7°fÑ=Ð>õð'	ð. <@¿>¹>×J©<¨G°QšwÓJˆÕùÓJs   Å
E c                 óF  — d| _         | j                  x| _        | _        | j                  dk(  rd| _        | j                  dv rd| _        | j                  dk(  rd| _        | j                  dk(  rd| _        d| _        | j                  dv rt        j
                  | _         y	y	)
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.
        r   r   )r   r   r   r)   r   r
   r   )r   r   N)r   r   ÚstartÚjoin_strr   r1   r!   s    r   r   zURIVariable.post_parse|   sŽ   € ð ˆŒ	Ø%)§]¡]Ð2ˆŒ
�T”]Ø�=‰=˜CÒØˆDŒJØ�=‰=˜NÑ*ØˆDŒMØ�=‰=˜CÒØˆDŒJØ�=‰=˜CÒØˆDŒJØˆDŒMà�=‰=˜JÑ&Ü#×,Ñ,ˆD�Ið 'r   r:   Úvaluer.   r/   c                 ó  ‡‡— |€yt        |«      \  }}| j                  Št        |«      rx|sv|syt        j                  t        j
                  t           |«      }|r%| j                  j                  ˆˆfd„|D «       «      S dj                  ˆfd„|D «       «      }‰› d|› �S t        |«      s|r˜|syt        j                  t        j                  t        t        f   |«      }|xs t        |j                  «       «      }|r$| j                  j                  ˆfd„|D «       «      S dj                  ˆfd„|D «       «      }‰› d|› �S |r>t        j                  t        j                  |«      }|r|d| n|}‰› dt        |‰«      › �S ‰dz   S )z/Expansion method for the '?' and '&' operators.Nc              3   ó@   •K  — | ]  }‰› d t        |‰«      › �–— Œ y­w©r*   N©Úquote©Ú.0Úvr:   r   s     €€r   ú	<genexpr>z/URIVariable._query_expansion.<locals>.<genexpr>¤   s(   øè ø€ ò *Ø34�t�f˜Aœe A t›nÐ-Ô.ñ*ùs   ƒr)   c              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wr$   rE   ©rH   rI   r   s     €r   rJ   z/URIVariable._query_expansion.<locals>.<genexpr>¨   ó   øè ø€ Ò ?°A¤ q¨$§Ñ ?ùó   ƒr*   c              3   óZ   •K  — | ]"  \  }}t        |‰«      › d t        |‰«      › �–— Œ$ y­wrD   rE   ©rH   ÚkrI   r   s      €r   rJ   z/URIVariable._query_expansion.<locals>.<genexpr>±   s3   øè ø€ ò *Ù=A¸QÀ”u˜Q “~Ð& a¬¨a°«Ð'7Ô8ñ*ùó   ƒ(+c              3   óZ   •K  — | ]"  \  }}t        |‰«      › d t        |‰«      › �–— Œ$ y­w)r)   NrE   rP   s      €r   rJ   z/URIVariable._query_expansion.<locals>.<genexpr>µ   s3   øè ø€ ò !Ù=A¸QÀ”u˜Q “~Ð& a¬¨a°«Ð'7Ô8ñ!ùrR   )Úis_list_of_tuplesr   Ú	list_testÚtÚcastÚSequenceÚScalarVariableValuer@   ÚjoinÚ	dict_testÚMappingÚstrÚsortedÚitemsÚTextrF   )r   r:   rA   r.   r/   Útuplesr_   r   s    `     @r   Ú_query_expansionzURIVariable._query_expansion‘   s€  ù€ ð ˆ=Øä)¨%Ó0‰ˆ�à�y‰yˆÜ�UÔ¡FÙØÜ—F‘Fœ1Ÿ:™:Ô&9Ñ:¸EÓBˆEÙØ—}‘}×)Ñ)ô *Ø8=ô*ó ð ð Ÿ™Ó ?¸Ô ?Ó?�Ø˜˜q  Ð(Ð(ä�UÔ™vÙØÜ—F‘Fœ1Ÿ9™9¤SÔ*=Ð%=Ñ>ÀÓFˆEØÒ2œV E§K¡K£MÓ2ˆEÙØ—}‘}×)Ñ)ó *ØEJô*ó ð ð Ÿ™ó !ØEJô!ó �ð ˜˜q  Ð(Ð(áÜ—F‘Fœ1Ÿ6™6 5Ó)ˆEÙ&,�E˜'˜6‘N°%ˆEØ�V˜1œU 5¨$Ó/Ð0Ð1Ð1Ø�c‰zÐr   c                 ó  ‡‡— | j                   }| j                  Š|�.t        |t        t        t
        t        f«      st        |«      dk(  ryt        |«      \  }}t        |«      rb|s`|sd}t        j                  t        j                  t           |«      }|D �cg c]  }|€Œt        |‰«      ‘Œ }	}|	r|j                  |	«      S dS t!        |«      s|rwt        j                  t        j"                  t        t        f   |«      }|xs t%        |j'                  «       «      }dŠ|sdŠd}|j                  ˆˆfd„|D «       «      }
|
r|
S dS t        j                  t        j(                  |«      }|r|d| n|}t        |‰«      S c c}w )zSLabel and path expansion method.

        Expands for operators: '/', '.'

        Nr   r)   ú%s=%sú%s,%sc              3   ó^   •K  — | ]$  \  }}|�‰t        |‰«      t        |‰«      fz  –— Œ& y ­wr$   rE   )rH   rQ   rI   Ú
format_strr   s      €€r   rJ   z4URIVariable._label_path_expansion.<locals>.<genexpr>ç   s8   øè ø€ ò %á�A�qØ�=ð œe A t›n¬e°A°t«nÐ=Õ=ñ%ùó   ƒ*-)r@   r   Ú
isinstancer]   r5   ÚfloatÚcomplexÚlenrT   rU   rV   rW   rX   rY   rF   rZ   r[   r\   r^   r_   r`   )r   r:   rA   r.   r/   r@   ra   r_   rI   Ú	fragmentsÚexpandedrg   r   s              @@r   Ú_label_path_expansionz!URIVariable._label_path_expansionÀ   sZ  ù€ ð —=‘=ˆØ�y‰yˆàˆ=Ü˜5¤3¬¬U´GÐ"<Ô=Ü�E“
˜a’àä)¨%Ó0‰ˆ�ä�UÔ¡FÙØ�ä—F‘Fœ1Ÿ:™:Ô&9Ñ:¸EÓBˆEØ16ÖH¨A¸!¹-œ˜q $�ÐHˆIÐHÙ/8�8—=‘= Ó+ÐB¸dÐBä�UÔ™vÜ—F‘Fœ1Ÿ9™9¤SÔ*=Ð%=Ñ>ÀÓFˆEØÒ2œV E§K¡K£MÓ2ˆEØ ˆJÙØ$�
Ø�à—}‘}ô %à!ô%ó ˆHñ
  (�8Ð1¨TÐ1ä—‘”q—v‘v˜uÓ%ˆÙ"(��g�v‘¨eˆÜ�U˜DÓ!Ð!ùò) Is   ÂFÂ"Fc                 ó&  ‡‡	— | j                   }| j                  Š	|€y| j                  dk(  rd}t        |«      \  }}t	        |«      rq|sot        j                  t
        j                  t           |«      }|r!|j                  ˆˆ	fd„|D «       «      }|r|S dS dj                  ˆ	fd„|D «       «      }‰› d|› �S t        |«      s|r‹t        j                  t
        j                  t        t        f   |«      }|xs t        |j                  «       «      }|r|j                  ˆ	fd„|D «       «      S dj                  ˆ	fd	„|D «       «      }‰› d|› �S t        j                  t
        j                  |«      }|r|d| n|}|r‰› dt!        |‰	«      › �S ‰S )
z"Expansion method for ';' operator.Nr
   r   c              3   óF   •K  — | ]  }|€Œ‰› dt        |‰«      › �–— Œ y ­w©Nr*   rE   rG   s     €€r   rJ   z3URIVariable._semi_path_expansion.<locals>.<genexpr>  s,   øè ø€ ò )Ø34ÀÁ�t�f˜Aœe A t›nÐ-Ô.ñ)ùs   ƒ!‹!r)   c              3   ó6   •K  — | ]  }t        |‰«      –— Œ y ­wr$   rE   rL   s     €r   rJ   z3URIVariable._semi_path_expansion.<locals>.<genexpr>  rM   rN   r*   c              3   ó^   •K  — | ]$  \  }}|�t        |‰«      › dt        |‰«      › �–— Œ& y ­wrr   rE   rP   s      €r   rJ   z3URIVariable._semi_path_expansion.<locals>.<genexpr>  s;   øè ø€ ò %á˜˜1Ø�}ô ˜Q “~Ð& a¬¨a°«Ð'7Ô8ñ%ùrh   c              3   ó^   •K  — | ]$  \  }}|�t        |‰«      › dt        |‰«      › �–— Œ& y ­w)Nr)   rE   rP   s      €r   rJ   z3URIVariable._semi_path_expansion.<locals>.<genexpr>  s;   øè ø€ ò $á˜˜1Ø�}ô ˜Q “~Ð& a¬¨a°«Ð'7Ô8ñ$ùrh   )r@   r   r   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   rF   )
r   r:   rA   r.   r/   r@   ra   r_   rn   r   s
    `       @r   Ú_semi_path_expansionz URIVariable._semi_path_expansionò   s‡  ù€ ð —=‘=ˆØ�y‰yˆàˆ=Øà�=‰=˜CÒØˆHä)¨%Ó0‰ˆ�ä�UÔ¡FÜ—F‘Fœ1Ÿ:™:Ô&9Ñ:¸EÓBˆEÙØ#Ÿ=™=ô )Ø8=ô)ó �ñ $,�xÐ5°Ð5àŸ™Ó ?¸Ô ?Ó?�Ø˜˜q  Ð(Ð(ä�UÔ™vÜ—F‘Fœ1Ÿ9™9¤SÔ*=Ð%=Ñ>ÀÓFˆEØÒ2œV E§K¡K£MÓ2ˆEáØ—}‘}ó %à %ô%ó ð ð Ÿ8™8ó $à %ô$ó �ð
 ˜˜q  
Ð+Ð+ä—‘”q—v‘v˜uÓ%ˆÙ"(��g�v‘¨eˆÙØ�V˜1œU 5¨$Ó/Ð0Ð1Ð1àˆr   c                 óJ  ‡ ‡— |€y t        |«      \  }}t        |«      rG|sEt        j                  t        j                  t
           |«      }dj                  ˆ fd„|D «       «      S t        |«      s|rot        j                  t        j                  t        t
        f   |«      }|xs t        |j                  «       «      }|rdndŠdj                  ˆˆ fd„|D «       «      S t        j                  t        j                  |«      }|r|d | n|}t        |‰ j                  «      S )Nr)   c              3   óJ   •K  — | ]  }t        |‰j                  «      –— Œ y ­wr$   ©rF   r   )rH   rI   r   s     €r   rJ   z0URIVariable._string_expansion.<locals>.<genexpr>7  s   øè ø€ Ò?°AœE ! T§Y¡Y×/Ñ?ùs   ƒ #rd   re   c              3   ó‚   •K  — | ]6  \  }}‰t        |‰j                  «      t        |‰j                  «      fz  –— Œ8 y ­wr$   ry   )rH   rQ   rI   rg   r   s      €€r   rJ   z0URIVariable._string_expansion.<locals>.<genexpr>>  s=   øè ø€ ò á�A�qð œe A t§y¡yÓ1´5¸¸D¿I¹IÓ3FÐGÕGñùs   ƒ<?)rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   rF   r   )r   r:   rA   r.   r/   ra   r_   rg   s   `      @r   Ú_string_expansionzURIVariable._string_expansion)  sï   ù€ ð ˆ=Øä)¨%Ó0‰ˆ�ä�UÔ¡FÜ—F‘Fœ1Ÿ:™:Ô&9Ñ:¸EÓBˆEØ—8‘8Ó?¸Ô?Ó?Ð?ä�UÔ™vÜ—F‘Fœ1Ÿ9™9¤SÔ*=Ð%=Ñ>ÀÓFˆEØÒ2œV E§K¡K£MÓ2ˆEÙ$+™°ˆJà—8‘8ô à!ôó ð ô
 —‘”q—v‘v˜uÓ%ˆÙ"(��g�v‘¨eˆÜ�U˜DŸI™IÓ&Ð&r   Úvar_dictc                 óR  — g }|€| j                   | j                   iS | j                  D ]Ã  \  }}|j                  |d«      }|s"|dk7  r|| j                  v r| j                  |   }|€Œ?d}| j                  dv r| j
                  }nC| j                  dv r| j                  }n(| j                  dk(  r| j                  }n| j                  } ||||d   |d   «      }|€Œ³|j                  |«       ŒÅ d}|r(| j                  | j                  j                  |«      z   }| j                   |iS )a1  Expand 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   )r   r   )r
   r   r	   r.   r/   )r   r   Úgetr   r   ro   rb   rv   r{   r6   r?   r@   rZ   )r   r|   Úreturn_valuesr:   ÚoptsrA   rn   Ú	expansions           r   ÚexpandzURIVariable.expandG  s*  € ð: ˆØÐØ—M‘M 4§=¡=Ð1Ð1àŸ.™.ò 	/‰JˆD�$Ø—L‘L  tÓ,ˆEÙ˜U bš[¨T°T·]±]Ñ-BØŸ™ dÑ+�àˆ}ØàˆHØ�}‰} 
Ñ*Ø ×6Ñ6‘	Ø—‘ *Ñ,Ø ×1Ñ1‘	Ø—‘ #Ò%Ø ×5Ñ5‘	à ×2Ñ2�	á   u¨d°9©o¸tÀH¹~ÓNˆHàÑ#Ø×$Ñ$ XÕ.ð+	/ð. ˆÙØ—J‘J §¡×!3Ñ!3°MÓ!BÑBˆEØ—‘˜uÐ%Ð%r   )r   Nr$   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0   r1   r]   r   r"   r%   r   r   ÚVariableValueÚboolrV   ÚOptionalr5   rb   ro   rv   r{   ÚVariableValueDictr\   r‚   r    r   r   r   r      sŒ  „ ñð$ C€IØ#€Hð˜Có ð&(˜#ó (ð˜ó ó+KóZ-ð*-àð-ð ð-ð ð	-ð
 —
‘
˜3‘ð-ð 
�‰�C‰ó-ð^0"àð0"ð ð0"ð ð	0"ð
 —
‘
˜3‘ð0"ð 
�‰�C‰ó0"ðd5àð5ð ð5ð ð	5ð
 —
‘
˜3‘ð5ð 
�‰�C‰ó5ðn'àð'ð ð'ð ð	'ð
 —
‘
˜3‘ð'ð 
�‰�C‰ó'ð> 9=ñ;&ØŸ
™
Ð#4Ñ5ð;&à	
�‰�3˜�8Ñ	ô;&r   r   rA   r   c                 ó`   — | r(t        | t        t        f«      rt        d„ | D «       «      syd| fS )Nc              3   ó\   K  — | ]$  }t        |t        «      xr t        |«      d k(  –— Œ& y­w)r(   N)ri   r3   rl   )rH   rV   s     r   rJ   z$is_list_of_tuples.<locals>.<genexpr>‹  s'   è ø€ ÒG¸A”:˜a¤Ó'Ò7¬C°«F°a©KÓ7ÑGùs   ‚*,)FNT)ri   Úlistr3   Úall©rA   s    r   rT   rT   …  s0   € ñ Ü˜%¤$¬ Ô/ÜÑGÀÔGÔGàà�ˆ;Ðr   c                 ó.   — t        | t        t        f«      S r$   )ri   r�   r3   r�   s    r   rU   rU   ’  s   € Ü�eœd¤E˜]Ó+Ð+r   c                 óV   — t        | t        t        j                  j                  f«      S r$   )ri   ÚdictÚcollectionsÚabcÚMutableMappingr�   s    r   r[   r[   –  s   € Ü�eœd¤K§O¡O×$BÑ$BÐCÓDÐDr   Úencodingc                 óH   — t        | t        «      r| j                  |«      S | S r$   )ri   r]   Úencode)rA   r–   s     r   Ú_encoder™   š  s    € Ü�%œÔØ�|‰|˜HÓ%Ð%Ø€Lr   r   c                 ó–   — t        | t        t        f«      st        | «      } t        j                  j                  t        | «      |«      S r$   )ri   r]   ÚbytesÚurllibr   rF   r™   )rA   r   s     r   rF   rF      s4   € Ü�eœc¤5˜\Ô*Ü�E“
ˆÜ�<‰<×Ñœg e›n¨dÓ3Ð3r   )zutf-8)r†   Úcollections.abcr“   ÚtypingrV   Úurllib.parserœ   ÚUnionr5   rj   rk   r]   rY   rX   r\   ÚTupler‡   ÚDictrŠ   r   ÚAnyrˆ   r‰   rT   rU   r[   ÚAnyStrr›   r™   rF   r    r   r   ú<module>r¥      sL  ðñó  Û Û à—g‘g˜c 5¨'°3Ð6Ñ7Ð Ø—‘Ø‡J�JÐ"Ñ#Ø‡I�IˆcÐ&Ð&Ñ'Ø‡G�GˆCÐ$Ð$Ñ%Øðñ€ð —F‘F˜3 Ð-Ñ.Ð ÷c&ñ c&ðL
Ø�5‰5ð
à‡W�WˆT�1—:‘:˜aŸj™j¨¯©°Ð6IÐ1IÑ)JÑKÑLÐLÑMó
ð,�Q—U‘Uð ,˜tó ,ðE�Q—U‘Uð E˜tó Eñ�1—8‘8ð  sð ¸ó ð4�—‘ð 4˜cð 4 cô 4r   