+
    oisG                     l  a  R t20 t R t^ RIt^ RIt^ RIt^ RIt^ RIt	]P                  ]]]]R3,          t]P                  ]P                   ],          ]P"                  ],          ]P$                  ]]3,          ]P&                  ]]3,          ]3,          t]P*                  ]]3,          t]P.                   ]P0                   R2t] ^ k Rt] ^k Rt] ^k ] ] 2t] ^k  ! R R]P:                  4      tR]P>                  R]P@                  R	]PB                  R
]PD                  R]PF                  R]PH                  R]PJ                  R]PL                  R]PN                  R]PP                  R]PR                  R]PT                  /t+] ^k  ! R R4      t,R R lt-R R lt.R R lt/R R R llt0R R lt1R# )!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?
>

Nz~-_.z:/?#[]@z!$&'()*+,;=c                      a  ] tR t^+t o RtRtRtRtRtRt	Rt
RtR	tR
tRtRtRtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR lt]V 3R lR l4       tRtV tR# )Operator +#./;?&=,!@|c                    < V ^8  d   QhRS[ /#    returnstr)format__classdict__s   "w/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/uritemplate/variable.py__annotate__Operator.__annotate__G   s      S     c                    V \         P                  8X  d   \        R ,           # V \         P                  8X  d   \        # R# )%r   )r   reserved_RESERVED_CHARACTERSfragmentselfs   &r   reserved_charactersOperator.reserved_charactersG   s4     8$$$'#--8$$$''r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   r   W   s     " "S "r   c                    V \         P                  8X  d   R# V \         P                  8X  d   R# V \         P                  8X  d   R# V \         P                  8X  g   V \         P
                  8X  d   R# R# )a  Identify the separator used during expansion.

Per `Section 3.2.1. Variable Expansion`_:

======  ===========    =========
Type    Separator
======  ===========    =========
        ``","``        (default)
``+``   ``","``
``#``   ``","``
``.``   ``"."``
``/``   ``"/"``
``;``   ``";"``
``?``   ``"&"``
``&``   ``"&"``
======  ===========    =========

.. _`Section 3.2.1. Variable Expansion`:
    https://www.rfc-editor.org/rfc/rfc6570#section-3.2.1
r   r   r	   r   r   )r   label_with_dot_prefixpath_segmentpath_style_parameterform_style_queryform_style_query_continuationr"   s   &r   expansion_separatorOperator.expansion_separatorW   s[    * 81118(((8000H---x=== r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   r      s     ' ' 'r   c                z    V \         P                  8X  d   R # \        P                  ! \        V P
                  4      # r   )r   r   tcastr   valuer"   s   &r   variable_prefixOperator.variable_prefix   s(    8$$$vvc4::&&r   c                &   < V ^8  d   QhRS[ RS[ /# r   r4   r   r   )r   r   s   "r   r   r      s        3  3  r   c                    \        VR 4      # r1   quoter#   r4   s   &&r   _always_quoteOperator._always_quote   s    UBr   c                &   < V ^8  d   QhRS[ RS[ /# r8   r   )r   r   s   "r   r   r      s      S S r   c                n    \         P                  P                  V4      V8X  d   \        V\        4      # V# N)urllibparseunquoter;   r    r<   s   &&r   _only_quote_unquoted_characters(Operator._only_quote_unquoted_characters   s,    <<&%/ 455r   c                :   < V ^8  d   QhRS[ P                  RS[/# r8   r2   Anyr   )r   r   s   "r   r   r      s     ) )155 )S )r   c                4   \        V\        \        34      '       g   \        V4      p\        V\        4      '       d   VP                  4       pV \        P
                  8X  g   V \        P                  8X  d   V P                  V4      # V P                  V4      # rA   )	
isinstancer   bytesdecoder   r   r!   rE   r=   r<   s   &&r   r;   Operator.quote   sq    %#u..JEeU##LLNE8$$$0A0A(A77>>!!%((r   c                $   < V ^8  d   QhRS[ RR/# )r   sr   r   r   )r   r   s   "r   r   r      s     3 3s 3z 3r   c                J    \         P                  V \        P                  4      # rA   )
_operatorsgetr   default)rP   s   &r   from_stringOperator.from_string   s    ~~a!1!122r    N)__name__
__module____qualname____firstlineno__rT   r   r!   r(   r)   r*   r+   r,   reserved_eqreserved_commareserved_bangreserved_atreserved_piper$   r-   r5   r=   rE   r;   staticmethodrU   __static_attributes____classdictcell__r   s   @r   r   r   +   s      GHH  L  $'!KNMKM  " "h' '    
) ) 3 3r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   c                      a  ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltRV 3R lR lltRtV tR# )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.

c                    < V ^8  d   QhRS[ /# )r   varr   )r   r   s   "r   r   URIVariable.__annotate__   s      C r   c                    Wn         \        P                  V n        . V n        . V n        / V n        V P                  4        R # rA   )originalr   rT   operator	variablesvariable_namesdefaultsrC   )r#   rh   s   &&r   __init__URIVariable.__init__   s:     "*"2"2  	 ,.DF

r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   ri      s     ( (# (r   c                    R V ,          # )zURIVariable(%s)rW   r"   s   &r   __repr__URIVariable.__repr__   s     4''r   c                    < V ^8  d   QhRS[ /# r   r   )r   r   s   "r   r   ri      s       r   c                    V P                   # rA   )rk   r"   s   &r   __str__URIVariable.__str__   s    }}r   c                   < V ^8  d   QhRR/# )r   r   NrW   )r   r   s   "r   r   ri      s     (K (Kt (Kr   c                   V P                   pV P                   ^ ,          ;p\        9   d.   \        P                  V4      V n        V P                   R,          pVP                  R4      pV F  pRpTpRV9   d   \        VP                  R^4      4      w  reVP                  R4      pVP                  R4      pRpRV9   d*   \        VP                  R^4      4      w  ri\        V	^
4      pV'       d   WPP                  V&   V P                  P                  VRVRV/34       K  	  V P                   U
Uu. uF  w  rV
NK	  	  upp
V n        R# u upp
i )	zyParse the variable.

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

:   NNr   Nr   *:explodeprefix)rk   rR   r   rU   rl   splittupleendswithrstripintro   rm   appendrn   )r#   var_list_stroperator_strvar_listrh   default_valnamer   r   
prefix_strvarname_s   &           r   rC   URIVariable.parse   s)    }} MM!,,L;$00>DM==,L%%c*CKD cz$)#))C*;$<!mmC(G;;s#D&*Fd{#(C);#< Z,&1d#NN!!	7Hf=>' . <@>>J><Gw>JJs   4Ec                   < V ^8  d   QhRS[ RS[RS[RS[P                  S[,          RS[P                  S[ ,          /# r   r   r4   r   r   r   r   VariableValueboolr2   Optionalr   )r   r   s   "r   r   ri     sM     . .. . 	.
 

3. 
C.r   c                J  aaa Vf   R# \        V4      w  rVV P                  P                  4       oV P                  P                  o\	        V4      '       d   V'       g   V'       g   R# \
        P                  ! \
        P                  \        ,          V4      pV'       d5   V P                  P                  4       P                  VV3R lV 4       4      # RP                  V3R lV 4       4      pS RV 2# \        V4      '       g	   V'       d   V'       g   R# \
        P                  ! \
        P                  \        \        3,          V4      pT;'       g    \        VP                  4       4      pV'       d5   V P                  P                  4       P                  VV3R lV 4       4      # RP                  VV3R lV 4       4      pS RV 2# V'       dB   \
        P                  ! \
        P                   V4      pV'       d   VRV MTpS RS! V4       2# SR,           # )z/Expansion method for the '?' and '&' operators.Nc              3   >   <"   T F  pS R S! V4       2x  K  	  R# 5ir   NrW   ).0v_quoter   s   & r   	<genexpr>/URIVariable._query_expansion.<locals>.<genexpr>#  s$      @38atfAfQi[)5s   r   c              3   4   <"   T F  pS! V4      x  K  	  R # 5irA   rW   )r   r   r   s   & r   r   r   '  s      :EqEs   r   c              3   V   <"   T F  w  r\        VS4       R S! V4       2x  K   	  R# 5ir   r:   r   kr   r   safes   &  r   r   r   0  s-      @@EuQ~&aq	{3   &)c              3   V   <"   T F  w  r\        VS4       R S! V4       2x  K   	  R# 5i)r   Nr:   r   s   &  r   r   r   4  s,      !@EuQ~&aq	{3r   )is_list_of_tuplesrl   r$   r;   	list_testr2   r3   SequenceScalarVariableValuer-   join	dict_testMappingr   sorteditemsText)	r#   r   r4   r   r   tuplesr   r   r   s	   &f&&&  @@r   _query_expansionURIVariable._query_expansion  s    =)%0}}002$$UFFF1::&9:EBE}}88:?? @38@    :E ::q((UvFF199S*=%=>FE22VEKKM2E}}88:?? @@E@    !@E!  q((FF1665)E&,E'6N%EV1VE]O,,czr   c                   < V ^8  d   QhRS[ RS[RS[RS[P                  S[,          RS[P                  S[ ,          /# r   r   )r   r   s   "r   r   ri   ?  sM     2* 2*2* 2* 	2*
 

32* 
C2*r   c                6  a aa S P                   P                  4       pS P                   P                  4       oVe7   \        V\        \
        \        \        34      '       g   \        V4      ^ 8X  d   R# \        V4      w  rg\        V4      '       d   V'       g   V'       g   Rp\        P                  ! \        P                  \        ,          V4      pV Uu. uF#  qf   K  S P                   P                  V4      NK%  	  p	pV	'       d   VP!                  V	4      # R# \#        V4      '       g	   V'       d   \        P                  ! \        P$                  \        \        3,          V4      pT;'       g    \'        VP)                  4       4      pRoV'       g   RoRpVP!                  VVV 3R lV 4       4      p
V
'       d   V
# R# \        P                  ! \        P*                  V4      pV'       d   VRV MTpS P                   P                  V4      # u upi )zCLabel and path expansion method.

Expands for operators: '/', '.'

Nr   %s=%s%s,%sc              3      <"   T F;  w  rVf   K  S\        VS4      SP                  P                  V4      3,          x  K=  	  R # 5irA   r;   rl   )r   r   r   
format_strr   r#   s   &  r   r   4URIVariable._label_path_expansion.<locals>.<genexpr>h  sB      %!DA F
eAtndmm.A.A!.DEEE!s
   A6A)rl   r-   r$   rK   r   r   floatcomplexlenr   r   r2   r3   r   r   r;   r   r   r   r   r   r   )r#   r   r4   r   r   join_strr   r   r   	fragmentsexpandedr   r   s   f&&&&      @@r   _label_path_expansion!URIVariable._label_path_expansion?  s    ==446}}002=53UG"<==E
a)%0UFFF1::&9:EBE05051&##A&   098==+BdBUvFF199S*=%=>FE22VEKKM2E J$
}} %!% H
  (81T1qvvu%"(gve}}""5))-s   H"Hc                   < V ^8  d   QhRS[ RS[RS[RS[P                  S[,          RS[P                  S[ ,          /# r   r   )r   r   s   "r   r   ri   s  sM     2 22 2 	2
 

32 
C2r   c                  a aa	 S P                   P                  4       pS P                   P                  4       o	Vf   R# \        V4      w  rg\	        V4      '       d   V'       g   \
        P                  ! \
        P                  \        ,          V4      pV'       d)   VP                  VV	3R lV 4       4      pV'       d   V# R# RP                  V	3R lV 4       4      pS RV 2# \        V4      '       g	   V'       d   \
        P                  ! \
        P                  \        \        3,          V4      pT;'       g    \        VP                  4       4      pV'       d   VP                  V	V 3R lV 4       4      # RP                  V	V 3R lV 4       4      pS RV 2# \
        P                  ! \
        P                  V4      pV'       d   VRV MTpV'       d!   S RS P                   P!                  V4       2# S# )z"Expansion method for ';' operator.Nc              3   P   <"   T F  qf   K  S R\        VS4       2x  K  	  R # 5iNr   r:   )r   r   r   r   s   & r   r   3URIVariable._semi_path_expansion.<locals>.<genexpr>  s)      )8=1.tfAeAtn-.s   &&r   c              3   <   <"   T F  p\        VS4      x  K  	  R # 5irA   r:   )r   r   r   s   & r   r   r     s      ?Aq$s   r   c              3      <"   T F7  w  rVf   K  \        VS4       RSP                  P                  V4       2x  K9  	  R # 5ir   r   r   r   r   r   r#   s   &  r   r   r     sB      % % AuQ~&a(;(;A(>'?@ %
   A2Ac              3      <"   T F7  w  rVf   K  \        VS4       RSP                  P                  V4       2x  K9  	  R # 5i)Nr   r   r   s   &  r   r   r     sB      $ % AuQ~&a(;(;A(>'?@ %r   )rl   r-   r$   r   r   r2   r3   r   r   r   r   r   r   r   r   r   r;   )
r#   r   r4   r   r   r   r   r   r   r   s
   ff&&&    @r   _semi_path_expansion URIVariable._semi_path_expansions  s    ==446}}002=)%0UFFF1::&9:EBE#== )8=)  $,x55 ? ??q((UvFF199S*=%=>FE22VEKKM2E}} % %%   88 $ %$ 
 q
++qvvu%"(gveV1T]]007899r   c                   < V ^8  d   QhRS[ RS[RS[RS[P                  S[,          RS[P                  S[ ,          /# r   r   )r   r   s   "r   r   ri     sM     * ** * 	*
 

3* 
C*r   c                  a a Vf   R # \        V4      w  rV\        V4      '       dT   V'       gL   \        P                  ! \        P                  \
        ,          V4      pRP                  V 3R lV 4       4      # \        V4      '       g	   V'       d   \        P                  ! \        P                  \        \
        3,          V4      pT;'       g    \        VP                  4       4      pV'       d   RMRoRP                  VV 3R lV 4       4      # \        P                  ! \        P                  V4      pV'       d   VR V MTpS P                  P                  V4      # )Nr   c              3   Z   <"   T F   pSP                   P                  V4      x  K"  	  R # 5irA   rl   r;   )r   r   r#   s   & r   r   0URIVariable._string_expansion.<locals>.<genexpr>  s#     BEqDMM//22Es   (+r   r   c              3      <"   T FD  w  rSSP                   P                  V4      SP                   P                  V4      3,          x  KF  	  R # 5irA   r   )r   r   r   r   r#   s   &  r   r   r     sE      !DA dmm11!4dmm6I6I!6LMMM!s   AA)r   r   r2   r3   r   r   r   r   r   r   r   r   r   rl   r;   )r#   r   r4   r   r   r   r   r   s   f&&&&  @r   _string_expansionURIVariable._string_expansion  s     =)%0UFFF1::&9:EBE88BEBBBUvFF199S*=%=>FE22VEKKM2E$+J88 !  
 qvvu%"(gve}}""5))r   Nc                t   < V ^8  d   QhRS[ P                  S[,          RS[ P                  S[S[3,          /# )r   var_dictr   )r2   r   VariableValueDictr   r   )r   r   s   "r   r   ri     s8     N& N&

#45N&	
38	N&r   c                   . pVf   V P                   V P                   /# V P                   EFP  w  r4VP                  VR4      pV'       g+   VR8w  d$   W0P                  9   d   V P                  V,          pVf   KP  RpV P                  \
        P                  8X  g    V P                  \
        P                  8X  d   V P                  pMV P                  \
        P                  8X  g    V P                  \
        P                  8X  d   V P                  pM8V P                  \
        P                  8X  d   V P                  pMV P                  pV! W5VR,          VR,          4      pVf   EK?  VP                  V4       EKS  	  RpV'       dI   V P                  P!                  4       V P                  P#                  4       P%                  V4      ,           pV P                   V/# )a  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   )rk   rm   rS   ro   rl   r   r)   r(   r   r+   r,   r   r*   r   r   r   r5   r-   r   )r#   r   return_valuesr   optsr4   r   	expansions   &&      r   expandURIVariable.expand  st   : MM4==11..JDLLt,EUb[T]]-Bd+}H!6!66==H$B$BB 66	!:!::==H$J$JJ 11	("?"?? 55	 22	 !d9otH~NH#$$X.K )N --/--335::=IJ  u%%r   )ro   rl   rk   rn   rm   rA   )rX   rY   rZ   r[   __doc__rp   rt   rx   rC   r   r   r   r   r   rb   rc   rd   s   @r   rf   rf      sr     $  ( ( (K (KT. .`2* 2*h2 2h* *<N& N& N&r   rf   c          
         V ^8  d   QhR\         P                  R\         P                  \        \         P                  \         P
                  \         P                  \        \        3,          ,          ,          3,          /# r8   )r2   rI   Tupler   r   r   r   r   )r   s   "r   r   r     sO     
 
55
WWT1::ajj6I1I)JKLLM
r   c                     V '       dW   \        V \        \        34      '       d;   \        ;QJ d    R  V  4       F  '       d   K   RM	  RM! R  V  4       4      '       g   R# RV 3# )c              3   n   "   T F+  p\        V\        4      ;'       d    \        V4      ^8H  x  K-  	  R# 5i)r   N)rK   r   r   )r   r2   s   & r   r   $is_list_of_tuples.<locals>.<genexpr>  s*     GA:a'77CFaK7s   55FT)FN)rK   listr   allr4   s   &r   r   r     sI     %$//sGGsssGGGG;r   c                D    V ^8  d   QhR\         P                  R\        /# r8   r2   rI   r   )r   s   "r   r   r   #  s     , ,QUU ,t ,r   c                 .    \        V \        \        34      # rA   )rK   r   r   r   s   &r   r   r   #  s    edE]++r   c                D    V ^8  d   QhR\         P                  R\        /# r8   r   )r   s   "r   r   r   '  s"     E EQUU Et Er   c                 V    \        V \        \        P                  P                  34      # rA   )rK   dictcollectionsabcMutableMappingr   s   &r   r   r   '  s    edKOO$B$BCDDr   c                P    V ^8  d   QhR\         P                  R\        R\        /# )r   r4   encodingr   )r2   AnyStrr   rL   )r   s   "r   r   r   +  s%      188 s  r   c                 T    \        V \        4      '       d   V P                  V4      # V # rA   )rK   r   encode)r4   r   s   &&r   _encoder   +  s#    %||H%%Lr   c                P    V ^8  d   QhR\         P                  R\        R\        /# )r   r4   r   r   rH   )r   s   "r   r   r   1  s%     4 4 4c 4c 4r   c                     \        V \        \        34      '       g   \        V 4      p \        P                  P                  \        V 4      V4      # rA   )rK   r   rL   rB   rC   r;   r   )r4   r   s   &&r   r;   r;   1  s7    ec5\**E
<<gend33r   c                   V ^8  d   Qh/ ^ \         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d:   \        P                  \        P                  \        \
        3,          ,          ;R&   # )r   _UNRESERVED_CHARACTERS_GEN_DELIMS_SUB_DELIMSr    rR   )__conditional_annotations__r2   Finalr   Dictr   )r   s   "r   r   r      s      D  EJ & %QWWS\ %KL * )QWWS\ )MN C Baggcl BOV AGGAFF3=)* Wr   )zutf-8)3r   r   collections.abcr   enumstringtypingr2   urllib.parserB   Unionr   r   r   r   r   r   Listr   r   r   r   r   ascii_lettersdigitsr   r   r   r    Enumr   r   r!   r(   r)   r*   r+   r,   r^   r`   r_   r\   r]   rR   rf   r   r   r   r   r;   r   )r   s   @r   <module>r
     s  "     ggc5'3<= JJ"#FFIIc&&'GGC$$%	 FF3-.  V]]O40   & %) )(3}[M%B  B~3tyy ~3D 					'	'			&	&	"	"	/	/									 	 .
  W& W&t

,E4r   