o
    ,º]MT  ã                   @   sò  d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZmZm	Z	m
Z
 ddlmZmZ ddlZer7de_ddlZg d	¢Zd
jZdjZdjZG dd„ deƒZejej d Zi dd“dd“dd“dd“dd“dd“dd“dd“d d!“d"d#“d$d%“d&d'“d(d)“d*d+“d,d-“d.d/“d0d1“i d2d3“d4d5“d6d7“d8d9“d:d;“d<d=“d>d?“d@dA“dBdC“dDdE“dFdG“dHdI“dJdK“dLdM“dNdO“dPdQ“dRdS“¥i dTdU“dVdW“dXdY“dZd[“d\d]“d^d_“d`da“dbdc“ddde“dfdg“dhdi“djdk“dldm“dndo“dpdq“drds“dtdu“¥i dvdw“dxdy“dzd{“d|d}“d~d“d€d�“d‚dƒ“d„d…“d†d‡“dˆd‰“dŠd‹“dŒd�“dŽd�“d�d‘“d’d““d”d•“d–d—“¥i d˜d™“dšd›“dœd�“dždŸ“d d¡“d¢d£“d¤d¥“d¦d§“d¨d©“dªd«“d¬d­“d®d¯“d°d±“d²d³“d´dµ“d¶d·“d¸d¹“¥i dºd»“d¼d½“d¾d¿“dÀdÁ“dÂdÃ“dÄdÅ“dÆdÇ“dÈdÉ“dÊdË“dÌdÍ“dÎdÏ“dÐdÑ“dÒdÓ“dÔdÕ“dÖd×“dØdÙ“dÚdÛ“¥i dÜdÝ“dÞdß“dàdá“dâdã“dädå“dædç“dèdé“dêdë“dìdí“dîdï“dðdñ“dòdó“dôdõ“död÷“dødù“dúdû“düdý“¥i dþdÿ“�d �d“�d�d“�d�d“�d�d“�d�d	“�d
�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“�d�d“¥i �d �d!“�d"�d#“�d$�d%“�d&�d'“�d(�d)“�d*�d+“�d,�d-“�d.�d/“�d0�d1“�d2�d3“�d4�d5“�d6�d7“�d8�d9“�d:�d;“�d<�d=“�d>�d?“�d@�dA“¥�dB�dC�dD�dE�dF�dG�dH�dI�dJ�dK�dL�dM�dNœ¥Zef�dO�dP„Ze �dQ¡Ze �dR¡Z�dS�dT„ Z g �dU¢Z!g �dV¢Z"de!e"f�dW�dX„Z#G �dY�dZ„ �dZeƒZ$�d[Z%e �d\e% �d] e% �d^ ej¡Z&G �d_�d`„ �d`eƒZ'G �da�db„ �dbe'ƒZ(dS (c  af
  
http.cookies module ported to python-future from Py3.3

Here's a sample session to show how to use this module.
At the moment, this is the only documentation.

The Basics
----------

Importing is easy...

   >>> from http import cookies

Most of the time you start by creating a cookie.

   >>> C = cookies.SimpleCookie()

Once you've created your Cookie, you can add values just as if it were
a dictionary.

   >>> C = cookies.SimpleCookie()
   >>> C["fig"] = "newton"
   >>> C["sugar"] = "wafer"
   >>> C.output()
   'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'

Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header.  This is the
default behavior.  You can change the header and printed
attributes by using the .output() function

   >>> C = cookies.SimpleCookie()
   >>> C["rocky"] = "road"
   >>> C["rocky"]["path"] = "/cookie"
   >>> print(C.output(header="Cookie:"))
   Cookie: rocky=road; Path=/cookie
   >>> print(C.output(attrs=[], header="Cookie:"))
   Cookie: rocky=road

The load() method of a Cookie extracts cookies from a string.  In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.

   >>> C = cookies.SimpleCookie()
   >>> C.load("chips=ahoy; vienna=finger")
   >>> C.output()
   'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger'

The load() method is darn-tootin smart about identifying cookies
within a string.  Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.

   >>> C = cookies.SimpleCookie()
   >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
   >>> print(C)
   Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;"

Each element of the Cookie also supports all of the RFC 2109
Cookie attributes.  Here's an example which sets the Path
attribute.

   >>> C = cookies.SimpleCookie()
   >>> C["oreo"] = "doublestuff"
   >>> C["oreo"]["path"] = "/"
   >>> print(C)
   Set-Cookie: oreo=doublestuff; Path=/

Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.

   >>> C = cookies.SimpleCookie()
   >>> C["twix"] = "none for you"
   >>> C["twix"].value
   'none for you'

The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.

   >>> C = cookies.SimpleCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   '7'
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number=7\r\nSet-Cookie: string=seven'

Finis.
é    )Úunicode_literals)Úprint_function)Údivision)Úabsolute_import)ÚchrÚdictÚintÚstr)ÚPY2Úas_native_strN)ÚCookieErrorÚ
BaseCookieÚSimpleCookieÚ z; ú c                   @   s   e Zd ZdS )r   N)Ú__name__Ú
__module__Ú__qualname__© r   r   úZ/var/www/html/myproject/venv/lib/python3.10/site-packages/future/backports/http/cookies.pyr   š   s    r   z!#$%&'*+-.^_`|~:ú z\000úz\001úz\002úz\003úz\004úz\005úz\006úz\007úz\010ú	z\011Ú
z\012úz\013úz\014úz\015úz\016úz\017úz\020úz\021úz\022úz\023úz\024úz\025úz\026úz\027úz\030úz\031úz\032úz\033úz\034úz\035úz\036úz\037ú,z\054ú;z\073ú"ú\"ú\z\\úz\177õ   Â€z\200õ   Â�z\201õ   Â‚z\202õ   Âƒz\203õ   Â„z\204õ   Â…z\205õ   Â†z\206õ   Â‡z\207õ   Âˆz\210õ   Â‰z\211õ   ÂŠz\212õ   Â‹z\213õ   ÂŒz\214õ   Â�z\215õ   ÂŽz\216õ   Â�z\217õ   Â�z\220õ   Â‘z\221õ   Â’z\222õ   Â“z\223õ   Â”z\224õ   Â•z\225õ   Â–z\226õ   Â—z\227õ   Â˜z\230õ   Â™z\231õ   Âšz\232õ   Â›z\233õ   Âœz\234õ   Â�z\235õ   Âžz\236õ   ÂŸz\237õ   Â z\240õ   Â¡z\241õ   Â¢z\242õ   Â£z\243õ   Â¤z\244õ   Â¥z\245õ   Â¦z\246õ   Â§z\247õ   Â¨z\250õ   Â©z\251õ   Âªz\252õ   Â«z\253õ   Â¬z\254õ   Â­z\255õ   Â®z\256õ   Â¯z\257õ   Â°z\260õ   Â±z\261õ   Â²z\262õ   Â³z\263õ   Â´z\264õ   Âµz\265õ   Â¶z\266õ   Â·z\267õ   Â¸z\270õ   Â¹z\271õ   Âºz\272õ   Â»z\273õ   Â¼z\274õ   Â½z\275õ   Â¾z\276õ   Â¿z\277õ   Ã€z\300õ   Ã�z\301õ   Ã‚z\302õ   Ãƒz\303õ   Ã„z\304õ   Ã…z\305õ   Ã†z\306õ   Ã‡z\307õ   Ãˆz\310õ   Ã‰z\311õ   ÃŠz\312õ   Ã‹z\313õ   ÃŒz\314õ   Ã�z\315õ   ÃŽz\316õ   Ã�z\317õ   Ã�z\320õ   Ã‘z\321õ   Ã’z\322õ   Ã“z\323õ   Ã”z\324õ   Ã•z\325õ   Ã–z\326õ   Ã—z\327õ   Ã˜z\330õ   Ã™z\331õ   Ãšz\332õ   Ã›z\333õ   Ãœz\334õ   Ã�z\335õ   Ãžz\336õ   ÃŸz\337õ   Ã z\340õ   Ã¡z\341õ   Ã¢z\342õ   Ã£z\343õ   Ã¤z\344õ   Ã¥z\345õ   Ã¦z\346õ   Ã§z\347õ   Ã¨z\350õ   Ã©z\351õ   Ãªz\352õ   Ã«z\353õ   Ã¬z\354õ   Ã­z\355õ   Ã®z\356õ   Ã¯z\357õ   Ã°z\360õ   Ã±z\361õ   Ã²z\362õ   Ã³z\363z\364z\365z\366z\367z\370z\371z\372z\373z\374z\375z\376z\377)õ   Ã´õ   Ãµõ   Ã¶õ   Ã·õ   Ã¸õ   Ã¹õ   Ãºõ   Ã»õ   Ã¼õ   Ã½õ   Ã¾õ   Ã¿c                    s4   t ‡ fdd„| D ƒƒr| S dtdd„ | D ƒƒ d S )zãQuote a string for use in a cookie header.

    If the string does not need to be double-quoted, then just return the
    string.  Otherwise, surround the string in doublequotes and quote
    (with a \) special characters.
    c                 3   s   � | ]}|ˆ v V  qd S ©Nr   ©Ú.0Úc©Ú
LegalCharsr   r   Ú	<genexpr>ò   ó   € z_quote.<locals>.<genexpr>r8   c                 s   s   � | ]	}t  ||¡V  qd S r¼   )Ú_TranslatorÚget)r¾   Úsr   r   r   rÂ   õ   s   € )ÚallÚ	_nulljoin)r	   rÁ   r   rÀ   r   Ú_quoteë   s   rÉ   z\\[0-3][0-7][0-7]z[\\].c                 C   sf  t | ƒdk r| S | d dks| d dkr| S | dd… } d}t | ƒ}g }d|  kr.|k r¯n t|ƒS t | |¡}t | |¡}|sQ|sQ| | |d … ¡ 	 t|ƒS d }}|r\| d¡}|rc| d¡}|r‚|rk||k r‚| | ||… ¡ | | |d  ¡ |d }n| | ||… ¡ | tt| |d |d … dƒƒ¡ |d }d|  kr®|k s3t|ƒS  t|ƒS )Né   r   r8   éÿÿÿÿé   é   é   )	ÚlenÚ
_OctalPattÚsearchÚ
_QuotePattÚappendÚstartr   r   rÈ   )ÚmystrÚiÚnÚresÚo_matchÚq_matchÚjÚkr   r   r   Ú_unquoteû   s@   íó


$íìrÝ   )ÚMonÚTueÚWedÚThuÚFriÚSatÚSun)NÚJanÚFebÚMarÚAprÚMayÚJunÚJulÚAugÚSepÚOctÚNovÚDecc              	   C   sR   ddl m}m } |ƒ }|||  ƒ\	}}}}	}
}}}}d|| ||| ||	|
|f S )Nr   )ÚgmtimeÚtimez#%s, %02d %3s %4d %02d:%02d:%02d GMT)rò   rñ   )ÚfutureÚweekdaynameÚ	monthnamerñ   rò   ÚnowÚyearÚmonthÚdayÚhhÚmmÚssÚwdÚyÚzr   r   r   Ú_getdate3  s   ÿr   c                	   @   s†   e Zd ZdZdddddddd	d
œZeddgƒZdd„ Zdd„ Zdd„ Z	e
fdd„Zddd„ZeZeƒ dd„ ƒZddd„Zddd„ZdS )ÚMorsela‘  A class to hold ONE (key, value) pair.

    In a cookie, each such pair may have several attributes, so this class is
    used to keep the attributes associated with the appropriate key,value pair.
    This class also includes a coded_value attribute, which is used to hold
    the network representation of the value.  This is most useful when Python
    objects are pickled for network transit.
    ÚexpiresÚPathÚCommentÚDomainzMax-AgeÚsecureÚhttponlyÚVersion)r  ÚpathÚcommentÚdomainúmax-ager  r  Úversionc                 C   s0   d  | _  | _| _| jD ]	}t | |d¡ qd S )Nr   )ÚkeyÚvalueÚcoded_valueÚ	_reservedr   Ú__setitem__)Úselfr  r   r   r   Ú__init__^  s   
ÿzMorsel.__init__c                 C   s0   |  ¡ }|| jvrtd| ƒ‚t | ||¡ d S )NzInvalid Attribute %s)Úlowerr  r   r   r  )r  ÚKÚVr   r   r   r  f  s   
zMorsel.__setitem__c                 C   s   |  ¡ | jv S r¼   )r  r  )r  r  r   r   r   ÚisReservedKeyl  s   zMorsel.isReservedKeyc                    sR   |  ¡ | jv rtd| ƒ‚t‡ fdd„|D ƒƒrtd| ƒ‚|| _|| _|| _d S )Nz!Attempt to set a reserved key: %sc                 3   s   � | ]}|ˆ vV  qd S r¼   r   r½   rÀ   r   r   rÂ   t  rÃ   zMorsel.set.<locals>.<genexpr>zIllegal key value: %s)r  r  r   Úanyr  r  r  )r  r  ÚvalÚ	coded_valrÁ   r   rÀ   r   Úseto  s   
z
Morsel.setNúSet-Cookie:c                 C   s   d||   |¡f S )Nz%s %s)ÚOutputString)r  ÚattrsÚheaderr   r   r   Úoutput|  s   zMorsel.outputc                 C   s>   t rt| jtƒrt| jƒ}n| j}d| jjt| jƒt|ƒf S )Nz<%s: %s=%s>)	r
   Ú
isinstancer  Úunicoder	   Ú	__class__r   r  Úrepr©r  r  r   r   r   Ú__repr__�  s   ÿzMorsel.__repr__c                 C   s   d|   |¡ dd¡ S )Nz—
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        r8   r9   )r  Úreplace)r  r  r   r   r   Ú	js_outputŠ  s   úzMorsel.js_outputc                 C   s  g }|j }|d| j| jf ƒ |d u r| j}t|  ¡ ƒ}|D ]a\}}|dkr'q||vr,q|dkrCt|tƒrC|d| j| t|ƒf ƒ q|dkrXt|tƒrX|d| j| |f ƒ q|dkrf|t	| j| ƒƒ q|dkrt|t	| j| ƒƒ q|d| j| |f ƒ qt
|ƒS )Nú%s=%sr   r  r  z%s=%dr  r  )rÓ   r  r  r  ÚsortedÚitemsr"  r   r   r	   Ú_semispacejoin)r  r  ÚresultrÓ   r,  r  r  r   r   r   r  ”  s*   zMorsel.OutputString)Nr  r¼   )r   r   r   Ú__doc__r  r  Ú_flagsr  r  r  Ú_LegalCharsr!  Ú__str__r   r'  r)  r  r   r   r   r   r  ;  s,    ø



r  z.[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=]z~
    (?x)                           # This is a verbose pattern
    (?P<key>                       # Start of group 'key'
    a  +?   # Any word of at least one letter
    )                              # End of group 'key'
    (                              # Optional group: there may not be a value.
    \s*=\s*                          # Equal Sign
    (?P<val>                         # Start of group 'val'
    "(?:[^\\"]|\\.)*"                  # Any doublequoted string
    |                                  # or
    \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT  # Special case for "expires" attr
    |                                  # or
    a,  *      # Any word or empty string
    )                                # End of group 'val'
    )?                             # End of optional value group
    \s*                            # Any number of spaces.
    (\s+|;|$)                      # Ending either at space, semicolon, or EOS.
    c                   @   st   e Zd ZdZdd„ Zdd„ Zddd„Zd	d
„ Zdd„ Zddd„Z	e	Z
eƒ dd„ ƒZddd„Zdd„ Zefdd„ZdS )r   z'A container class for a set of Morsels.c                 C   s   ||fS )a
  real_value, coded_value = value_decode(STRING)
        Called prior to setting a cookie's value from the network
        representation.  The VALUE is the value read from HTTP
        header.
        Override this function to modify the behavior of cookies.
        r   r&  r   r   r   Úvalue_decodeÙ  s   zBaseCookie.value_decodec                 C   s   t |ƒ}||fS )zýreal_value, coded_value = value_encode(VALUE)
        Called prior to setting a cookie's value from the dictionary
        representation.  The VALUE is the value being assigned.
        Override this function to modify the behavior of cookies.
        )r	   ©r  r  Ústrvalr   r   r   Úvalue_encodeâ  s   zBaseCookie.value_encodeNc                 C   s   |r	|   |¡ d S d S r¼   )Úload)r  Úinputr   r   r   r  ë  s   ÿzBaseCookie.__init__c                 C   s.   |   |tƒ ¡}| |||¡ t | ||¡ dS )z+Private method for setting a cookie's valueN)rÅ   r  r  r   r  )r  r  Ú
real_valuer  ÚMr   r   r   Ú__setï  s   zBaseCookie.__setc                 C   s    |   |¡\}}|  |||¡ dS )zDictionary style assignment.N)r6  Ú_BaseCookie__set)r  r  r  ÚrvalÚcvalr   r   r   r  õ  s   zBaseCookie.__setitem__r  ú
c                 C   s:   g }t |  ¡ ƒ}|D ]\}}| | ||¡¡ q
| |¡S )z"Return a string suitable for HTTP.)r+  r,  rÓ   r!  Újoin)r  r  r   Úsepr.  r,  r  r  r   r   r   r!  ú  s
   
zBaseCookie.outputc                 C   sn   g }t |  ¡ ƒ}|D ]"\}}trt|jtƒrt|jƒ}n|j}| dt|ƒt|ƒf ¡ q
d| j	j
t|ƒf S )Nr*  z<%s: %s>)r+  r,  r
   r"  r  r#  r	   rÓ   r%  r$  r   Ú
_spacejoin)r  Úlr,  r  r  r  r   r   r   r'    s   zBaseCookie.__repr__c                 C   s6   g }t |  ¡ ƒ}|D ]\}}| | |¡¡ q
t|ƒS )z(Return a string suitable for JavaScript.)r+  r,  rÓ   r)  rÈ   )r  r  r.  r,  r  r  r   r   r   r)    s
   zBaseCookie.js_outputc                 C   s6   t |tƒr|  |¡ dS | ¡ D ]\}}|| |< qdS )zÝLoad cookies from a string (presumably HTTP_COOKIE) or
        from a dictionary.  Loading cookies from a dictionary 'd'
        is equivalent to calling:
            map(Cookie.__setitem__, d.keys(), d.values())
        N)r"  r	   Ú_BaseCookie__parse_stringr,  )r  Úrawdatar  r  r   r   r   r7    s   

þ
zBaseCookie.loadc                 C   s  d}t |ƒ}d }d|  kr|k r„n d S | ||¡}|sd S | d¡| d¡}}| d¡}|d dkr@|r?|||dd … < n6| ¡ tjv r`|r_|d u rY| ¡ tjv rXd||< nt|ƒ||< n|d urv|  	|¡\}	}
|  
||	|
¡ | | }d|  kr�|k sd S  d S d S )Nr   r  r  ú$rÌ   T)rÏ   rÑ   ÚgroupÚendr  r  r  r0  rÝ   r3  r<  )r  rÕ   ÚpattrÖ   r×   r:  Úmatchr  r  r=  r>  r   r   r   Ú__parse_string&  s4   
€€€ äzBaseCookie.__parse_stringr¼   )Nr  r?  )r   r   r   r/  r3  r6  r  r<  r  r!  r2  r   r'  r)  r7  Ú_CookiePatternrD  r   r   r   r   r   Ö  s    	
	


r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   zþ
    SimpleCookie supports strings as cookie values.  When setting
    the value using the dictionary assignment notation, SimpleCookie
    calls the builtin str() to convert the value to a string.  Values
    received from HTTP are kept as strings.
    c                 C   s   t |ƒ|fS r¼   )rÝ   r&  r   r   r   r3  Q  s   zSimpleCookie.value_decodec                 C   s   t |ƒ}|t|ƒfS r¼   )r	   rÉ   r4  r   r   r   r6  T  s   zSimpleCookie.value_encodeN)r   r   r   r/  r3  r6  r   r   r   r   r   J  s    r   ))r/  Ú
__future__r   r   r   r   Úfuture.builtinsr   r   r   r	   Úfuture.utilsr
   r   ÚreÚASCIIÚstringÚ__all__r@  rÈ   r-  rB  Ú	Exceptionr   Úascii_lettersÚdigitsr1  rÄ   rÉ   ÚcompilerÐ   rÒ   rÝ   Ú_weekdaynameÚ
_monthnamer   r  Ú_LegalCharsPattrL  r   r   r   r   r   r   Ú<module>   sÀ  &[ÿÿÿþþþýýýüüüûûûúúúùùùøøø	÷	÷	÷
ö
ö
öõõððîîìììëëëêêêéééèèèçççæææåååäääãããâââááá à à à!ß!ß!ß"Þ"Þ"Þ#Ý#Ý#Ý$Ü$Ü$Ü%Û%Û%Û&Ú&Ú&Ú'Ù'Ù'Ù(Ø(Ø(Ø)×)×)×*Ö*Ö*Ö+Õ+Õ+Õ,Ô,Ô,Ô-Ó-Ó-Ó.Ò.Ò.Ò/Ñ/Ñ/Ñ0Ð0Ð0Ð1Ï1Ï1Ï2Î2Î2Î3Í3Í3Í4Ì4Ì4Ì5Ë5Ë5Ë6Ê6Ê6Ê7É7É7É8È8È8È9Ç9Ç9Ç:Æ:Æ:Æ;
ÂA
2
 ýýôôït