
    h>                    B   S SK Jr  S SKrS SKrS SKrS SKrS SKJr  SSK	J
r
  SSK	Jr  SSK	Jr  SSK	Jr  S	S
KJr  S	SKJr  \R"                  (       a  S SKr " S S5      rSSS jjr " S S5      rS rS H&  r\" \" \\5      5      r\" \\\5        \" \\\5        M(     g)    )annotationsNwraps   )dump_header)parse_dict_header)parse_set_header)quote_header_value   )CallbackDict)	HeaderSetc                      \ rS rSrSr  S       SS jjrSS jrSS jrSSS jjrSS jr	SS	 jr
\SS
 j5       rSS jrSS jrSS jrSrg)Authorization   a{  Represents the parts of an ``Authorization`` request header.

:attr:`.Request.authorization` returns an instance if the header is set.

An instance can be used with the test :class:`.Client` request methods' ``auth``
parameter to send the header in test requests.

Depending on the auth scheme, either :attr:`parameters` or :attr:`token` will be
set. The ``Basic`` scheme's token is decoded into the ``username`` and ``password``
parameters.

For convenience, ``auth["key"]`` and ``auth.key`` both access the key in the
:attr:`parameters` dict, along with ``auth.get("key")`` and ``"key" in auth``.

.. versionchanged:: 2.3
    The ``token`` parameter and attribute was added to support auth schemes that use
    a token instead of parameters, such as ``Bearer``.

.. versionchanged:: 2.3
    The object is no longer a ``dict``.

.. versionchanged:: 0.5
    The object is an immutable dict.
Nc                6    Xl          Uc  0 nX l         X0l        g N)type
parameterstoken)self	auth_typedatar   s       qC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\werkzeug/datastructures/auth.py__init__Authorization.__init__.   s,     	R<D	 
	    c                8    U R                   R                  U5      $ r   r   getr   names     r   __getattr__Authorization.__getattr__F       ""4((r   c                8    U R                   R                  U5      $ r   r   r    s     r   __getitem__Authorization.__getitem__I   r$   r   c                8    U R                   R                  X5      $ r   r   r   keydefaults      r   r   Authorization.getL       ""300r   c                    XR                   ;   $ r   r   r   r*   s     r   __contains__Authorization.__contains__O       oo%%r   c                    [        U[        5      (       d  [        $ UR                  U R                  :H  =(       a9    UR                  U R                  :H  =(       a    UR
                  U R
                  :H  $ r   )
isinstancer   NotImplementedr   r   r   r   others     r   __eq__Authorization.__eq__R   sX    %//!! JJ$))# 4tzz)4  DOO3	
r   c                   U(       d  gUR                  S5      u  p#nUR                  5       nUR                  5       nUS:X  aB   [        R                  " U5      R                  5       R                  S5      u  pSnU " X%US.5      $ SUR                  S5      ;   a  U " U[        U5      S5      $ U " USU5      $ ! [        R                  [        4 a     gf = f)zParse an ``Authorization`` header value and return an instance, or ``None``
if the value is empty.

:param value: The header value to parse.

.. versionadded:: 2.3
N basic:)usernamepassword=)	partitionlowerstripbase64	b64decodedecodebinasciiErrorUnicodeErrorrstripr   )clsvaluescheme_restr?   r@   s          r   from_headerAuthorization.from_header\   s     //#.4zz|W(.(8(8(>(E(E(G(Q(QRU(V%X v(KLL$++c""v06== 64&& NNL1 s   6B7 7CCc                   U R                   S:X  aQ  [        R                  " U R                   SU R                   3R                  5       5      R                  S5      nSU 3$ U R                  b)  U R                   R                  5        SU R                   3$ U R                   R                  5        S[        U R                  5       3$ )zYProduce an ``Authorization`` header value representing this data.

.. versionadded:: 2.0
r=   r>   utf8zBasic r<   )r   rE   	b64encoder?   r@   encoderG   r   titler   r   r   rM   s     r   	to_headerAuthorization.to_header{   s    
 99$$==/4==/299;fVn  E7##::!iioo'($**66))//#$Ak$//&B%CDDr   c                "    U R                  5       $ r   rY   r   s    r   __str__Authorization.__str__       ~~r   c                V    S[        U 5      R                   SU R                  5        S3$ N<r<   >r   __name__rY   r]   s    r   __repr__Authorization.__repr__   *    4:&&'q)9(:!<<r   )r   r   r   )NN)r   strr   dict[str, str] | Noner   
str | NonereturnNoner!   rj   rm   rl   r   r*   rj   r+   rl   rm   rl   r*   rj   rm   boolr8   objectrm   rr   rM   rl   rm   zte.Self | Nonerm   rj   )rf   
__module____qualname____firstlineno____doc__r   r"   r&   r   r1   r9   classmethodrQ   rY   r^   rg   __static_attributes__ r   r   r   r      sw    8 '+ 	 $ 	
 
0))1&
 ' '<E  =r   r   c                `   ^  [         R                  " S[        SS9  U 4S jn[        U 4S jX!S9$ )a  A static helper function for Authentication subclasses to add
extra authentication system properties onto a class::

    class FooAuthenticate(WWWAuthenticate):
        special_realm = auth_property('special_realm')

.. deprecated:: 2.3
    Will be removed in Werkzeug 3.0.
zB'auth_property' is deprecated and will be removed in Werkzeug 3.0.r   
stacklevelc                N   > Uc  U R                  TS 5        g [        U5      U T'   g r   )poprj   )r   rM   r!   s     r   
_set_value!auth_property.<locals>._set_value   s#    =HHT4 UDJr   c                &   > U R                  T5      $ r   )r   )xr!   s    r   <lambda>auth_property.<locals>.<lambda>   s    aeeDkr   )doc)warningswarnDeprecationWarningproperty)r!   r   r   s   `  r   auth_propertyr      s/     MML$ ):??r   c                  0  ^  \ rS rSrSr   S     SS jjrS S jr\S!S j5       r\R                  S"S j5       r\S#S j5       r
\
R                  S$S j5       r
\S%S	 j5       r\R                  S&S
 j5       rS'S(S jjr    S)             S*S jjrS+S jrS,S jrS-S jrS.S jrS/U 4S jjrS0S jrS1S jrS2S jrS3S4S jjr\S5S j5       rS!S jrS!S jrS!S jr\S6S j5       r\S7S j5       r\R                  S8S j5       r\" \5      rSr U =r!$ )9WWWAuthenticate   a  Represents the parts of a ``WWW-Authenticate`` response header.

Set :attr:`.Response.www_authenticate` to an instance of list of instances to set
values for this header in the response. Modifying this instance will modify the
header value.

Depending on the auth scheme, either :attr:`parameters` or :attr:`token` should be
set. The ``Basic`` scheme will encode ``username`` and ``password`` parameters to a
token.

For convenience, ``auth["key"]`` and ``auth.key`` both act on the :attr:`parameters`
dict, and can be used to get, set, or delete parameters. ``auth.get("key")`` and
``"key" in auth`` are also provided.

.. versionchanged:: 2.3
    The ``token`` parameter and attribute was added to support auth schemes that use
    a token instead of parameters, such as ``Bearer``.

.. versionchanged:: 2.3
    The object is no longer a ``dict``.

.. versionchanged:: 2.3
    The ``on_update`` parameter was removed.
c                   ^  Uc  [         R                  " S[        SS9  SnUR                  5       T l        [        UU 4S j5      T l        UT l        S T l        g )NzvAn auth type must be given as the first parameter. Assuming 'basic' is deprecated and will be removed in Werkzeug 3.0.r   r   r=   c                $   > TR                  5       $ r   _trigger_on_updaterO   r   s    r   r   *WWWAuthenticate.__init__.<locals>.<lambda>   s    d557r   )	r   r   r   rC   _typer   _parameters_token
_on_update)r   r   valuesr   s   `   r   r   WWWAuthenticate.__init__   s[     MMC"	  I__&
+77,
 FJr   c                B    U R                   b  U R                  U 5        g g r   )r   r]   s    r   r   "WWWAuthenticate._trigger_on_update   s    ??&OOD! 'r   c                    U R                   $ )zDThe authorization scheme, like ``basic``, ``digest``, or ``bearer``.)r   r]   s    r   r   WWWAuthenticate.type   s     zzr   c                0    Xl         U R                  5         g r   )r   r   rX   s     r   r   r      s    
!r   c                    U R                   $ zoA dict of parameters for the header. Only one of this or :attr:`token` should
have a value for a given scheme.
)r   r]   s    r   r   WWWAuthenticate.parameters   s    
 r   c                P   ^  [        UU 4S j5      T l        T R                  5         g )Nc                $   > TR                  5       $ r   r   r   s    r   r   ,WWWAuthenticate.parameters.<locals>.<lambda>   s    T446r   )r   r   r   rX   s   ` r   r   r      s$    '6
 	!r   c                    U R                   $ r   )r   r]   s    r   r   WWWAuthenticate.token   s    
 {{r   c                0    Xl         U R                  5         g)z~A token for the header. Only one of this or :attr:`parameters` should have a
value for a given scheme.

.. versionadded:: 2.3
N)r   r   rX   s     r   r   r      s     !r   c                    [         R                  " S5        SU l        [        R	                  U R
                  5        [        R                  U R
                  SU05        SU l        U R                  5         g)zClear any existing data and set a ``Basic`` challenge.

.. deprecated:: 2.3
    Will be removed in Werkzeug 3.0. Create and assign an instance instead.
zpThe 'set_basic' method is deprecated and will be removed in Werkzeug 3.0. Create and assign an instance instead.r=   realmN)	r   r   r   dictclearr   updater   r   )r   r   s     r   	set_basicWWWAuthenticate.set_basic  s^     	6	
 


4??#OOe	
 !r   c                D   [         R                  " S5        SU l        [        R	                  U R
                  5        UUSR                  U5      U(       a  SOSS.nUb  XGS'   Ub  XWS	'   [        R                  U R
                  U5        SU l        U R                  5         g)
zClear any existing data and set a ``Digest`` challenge.

.. deprecated:: 2.3
    Will be removed in Werkzeug 3.0. Create and assign an instance instead.
zqThe 'set_digest' method is deprecated and will be removed in Werkzeug 3.0. Create and assign an instance instead.digest, TRUEFALSE)r   nonceqopstaleNopaque	algorithm)
r   r   r   r   r   r   joinr   r   r   )r   r   r   r   r   r   r   r   s           r   
set_digestWWWAuthenticate.set_digest  s     	6	
 


4??#99S>$V'	

 #)x  &/{#DOOZ0!r   c                8    U R                   R                  U5      $ r   r   r0   s     r   r&   WWWAuthenticate.__getitem__@  s    ""3''r   c                    Uc  XR                   ;   a  U R                   U	 OX R                   U'   U R                  5         g r   r   r   )r   r*   rM   s      r   __setitem__WWWAuthenticate.__setitem__C  s6    =oo%OOC(#(OOC !r   c                ^    XR                   ;   a  U R                   U	 U R                  5         g g r   r   r0   s     r   __delitem__WWWAuthenticate.__delitem__L  s)    //!$##% "r   c                
    X   $ r   r}   r    s     r   r"   WWWAuthenticate.__getattr__Q  s
    zr   c                :   > US;   a  [         TU ]  X5        g X U'   g )N>   r   r   r   r   )super__setattr__)r   r!   rM   	__class__s      r   r   WWWAuthenticate.__setattr__T  s     CCG,Jr   c                    X	 g r   r}   r    s     r   __delattr__WWWAuthenticate.__delattr__Z  s    Jr   c                    XR                   ;   $ r   r/   r0   s     r   r1   WWWAuthenticate.__contains__]  r3   r   c                    [        U[        5      (       d  [        $ UR                  U R                  :H  =(       a9    UR                  U R                  :H  =(       a    UR
                  U R
                  :H  $ r   )r5   r   r6   r   r   r   r7   s     r   r9   WWWAuthenticate.__eq__`  sX    %11!! JJ$))# 4tzz)4  DOO3	
r   c                8    U R                   R                  X5      $ r   r   r)   s      r   r   WWWAuthenticate.getj  r-   r   c                    U(       d  gUR                  S5      u  p#nUR                  5       nUR                  5       nSUR                  S5      ;   a  U " U[	        U5      S5      $ U " USU5      $ )zParse a ``WWW-Authenticate`` header value and return an instance, or ``None``
if the value is empty.

:param value: The header value to parse.

.. versionadded:: 2.3
Nr<   rA   )rB   rC   rD   rK   r   )rL   rM   rN   rO   rP   s        r   rQ   WWWAuthenticate.from_headerm  si     //#.4zz|$++c""v06== 64&&r   c                   U R                   b)  U R                  R                  5        SU R                    3$ U R                  S:X  ak  / nU R                  R	                  5        H7  u  p#US;   a  [        USS9nO[        U5      nUR                  U SU 35        M9     SSR                  U5       3$ U R                  R                  5        S[        U R                  5       3$ )	zCProduce a ``WWW-Authenticate`` header value representing this data.r<   r   >   r   r   r   domainr   F)allow_tokenrA   zDigest r   )	r   r   rW   r   itemsr
   appendr   r   )r   r   r*   rM   s       r   rY   WWWAuthenticate.to_header  s    ::!iioo'($**6699 E"oo335
GG.u%HE.u5EuAeW-. 6 TYYu-.//))//#$Ak$//&B%CDDr   c                "    U R                  5       $ r   r\   r]   s    r   r^   WWWAuthenticate.__str__  r`   r   c                V    S[        U 5      R                   SU R                  5        S3$ rb   re   r]   s    r   rg   WWWAuthenticate.__repr__  ri   r   c                   ^  [         R                  " S[        SS9  SU 4S jjn[        T R                  R                  S5      U5      $ )zThe ``qop`` parameter as a set.

.. deprecated:: 2.3
    Will be removed in Werkzeug 3.0. It will become the same as other
    parameters, returning a string.
zThe 'qop' property is deprecated and will be removed in Werkzeug 3.0. It will become the same as other parameters, returning a string.r   r   c                b   > U (       d
  ST;   a  TS	 g U R                  5       TR                  S'   g )Nr   )rY   r   )rM   r   s    r   	on_update&WWWAuthenticate.qop.<locals>.on_update  s,    D=U%*__%6DOOE"r   r   )rM   r   rm   rn   )r   r   r   r	   r   r   )r   r   s   ` r   r   WWWAuthenticate.qop  s@     	P		
	7   3 3E :IFFr   c                    [         R                  " S[        SS9  SU R                  ;   a   U R                  S   R	                  5       S:H  $ g)zThe ``stale`` parameter as a boolean.

.. deprecated:: 2.3
    Will be removed in Werkzeug 3.0. It will become the same as other
    parameters, returning a string.
zThe 'stale' property is deprecated and will be removed in Werkzeug 3.0. It will become the same as other parameters, returning a string.r   r   r   trueN)r   r   r   r   rC   r]   s    r   r   WWWAuthenticate.stale  sJ     	P		
 doo%??7+113v==r   c                    Uc  SU R                   ;   a  U R                   S	 g [        U[        5      (       a3  [        R                  " S[
        SS9  U(       a  SOSU R                   S'   g XR                   S'   g )Nr   z\Setting the 'stale' property to a boolean is deprecated and will be removed in Werkzeug 3.0.r   r   r   r   )r   r5   rr   r   r   r   rX   s     r   r   r     sf    =$//)OOG,eT""MM,"	 27vGDOOG$',OOG$r   )r   r   r   r   )NNN)r   rl   r   rk   r   rl   )rm   rn   rv   )rM   rj   rm   rn   )rm   dict[str, str])rM   r   rm   rn   )rm   rl   )rM   rl   rm   rn   )zauthentication required)r   rj   rm   rn   ))authNNF)r   rj   r   rj   r   zt.Sequence[str]r   rl   r   rl   r   rr   rm   rn   )r*   rj   rm   rl   )r*   rj   rM   rl   rm   rn   )r*   rj   rm   rn   ro   )r!   rj   rM   rl   rm   rn   )r!   rj   rm   rn   rq   rs   r   rp   ru   )rm   zset[str])rm   zbool | None)rM   zbool | str | Nonerm   rn   )"rf   rw   rx   ry   rz   r   r   r   r   setterr   r   r   r   r&   r   r   r"   r   r   r1   r9   r   r{   rQ   rY   r^   rg   r   r   staticmethodr   r|   __classcell__)r   s   @r   r   r      s   6 !%(, 	KK &K 	K,"   
[[" "     " "   \\" "".  )! $#"#" #" 	#"
 #" #" #" 
#"J("&
&
1 ' ',E( = G G2  & \\- -$ !/Mr   r   c                0   ^  [        T 5      U 4S j5       nU$ )Nc                 H   > [         R                  " S[        SS9  T" U 0 UD6$ )NzTreating 'Authorization' and 'WWWAuthenticate' as a dict is deprecated and will be removed in Werkzeug 3.0. Use the 'parameters' attribute instead.r   r   )r   r   r   )argskwargsfs     r   wrapper(_deprecated_dict_method.<locals>.wrapper  s-    X		
 $!&!!r   r   )r   r   s   ` r   _deprecated_dict_methodr     s     
1X" " Nr   )
__iter__r   copyr   keysr   popitem
setdefaultr   r   r   )r!   rj   r   rl   rm   r   )
__future__r   rE   rH   typingtr   	functoolsr   httpr   r   r	   r
   
structuresr   r   TYPE_CHECKINGtyping_extensionster   r   r   r   r!   getattrr   r   setattrr}   r   r   <module>r     s    "       $ # % $ !??"{= {=|@2t0 t0n	D 	 d 34AM4#OT1%r   