
    9iMT                        S 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JrJ	r	J
r
  SSKJrJr  SSKr\(       a  S\l        SSKr/ S	QrS
R$                  rSR$                  rSR$                  r " S S\5      r\R0                  \R2                  -   S-   r0 SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_S$S%_S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_0 S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_SFSG_SHSI_SJSK_SLSM_SNSO_SPSQ_SRSS_E0 STSU_SVSW_SXSY_SZS[_S\S]_S^S__S`Sa_SbSc_SdSe_SfSg_ShSi_SjSk_SlSm_SnSo_SpSq_SrSs_StSu_E0 SvSw_SxSy_SzS{_S|S}_S~S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_E0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_E0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_E0 SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_E0 SS_GS GS_GSGS_GSGS_GSGS_GSGS	_GS
GS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_GSGS_E0 GS GS!_GS"GS#_GS$GS%_GS&GS'_GS(GS)_GS*GS+_GS,GS-_GS.GS/_GS0GS1_GS2GS3_GS4GS5_GS6GS7_GS8GS9_GS:GS;_GS<GS=_GS>GS?_GS@GSA_EGSBGSCGSDGSEGSFGSGGSHGSIGSJGSKGSLGSMGSN.Er\4GSO jr\R:                  " GSP5      r\R:                  " GSQ5      rGSR r / GSSQr!/ GSTQr"S\!\"4GSU jr# " GSV GSW\5      r$GSXr%\R:                  " GSY\%-   GSZ-   \%-   GS[-   \R                  5      r& " GS\ GS]\5      r' " GS^ GS_\'5      r(g(`  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                       \ rS rSrSrg)r       N)__name__
__module____qualname____firstlineno____static_attributes__r       ]/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/future/backports/http/cookies.pyr   r      s    r   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                 l   ^ [        U4S jU  5       5      (       a  U $ S[        S U  5       5      -   S-   $ )zQuote 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   ,   >#    U  H	  oT;   v   M     g 7fNr   .0c
LegalCharss     r   	<genexpr>_quote.<locals>.<genexpr>   s     
(Cq
?C   r>   c              3   L   #    U  H  n[         R                  X5      v   M     g 7fr   )_Translatorget)r   ss     r   r   r      s     Bc{q44cs   "$)all	_nulljoin)r
   r   s    `r   _quoter      s6     
(C
(((
YBcBBBSHHr   z\\[0-3][0-7][0-7]z[\\].c           
         [        U 5      S:  a  U $ U S   S:w  d	  U S   S:w  a  U $ U SS n Sn[        U 5      n/ nSUs=::  a  U:  Ga  O  GO[        R                  X5      n[        R                  X5      nU(       d  U(       d  UR	                  XS  5        OS=pgU(       a  UR                  S5      nU(       a  UR                  S5      nU(       a;  U(       a  Xv:  a/  UR	                  XU 5        UR	                  XS-      5        US-   nODUR	                  XU 5        UR	                  [        [        XS-   US-    S5      5      5        US-   nSUs=::  a	  U:  a  GM  O  [        U5      $ )N   r   r>            )	len
_OctalPattsearch
_QuotePattappendstartr   r	   r   )mystrinreso_matchq_matchjks           r   _unquoter      sK    5zA~Qx3%)s* !BKE 	
AE
A
C
q*1**##E-##E-wJJuRy!
a Aa AGquJJuqz"JJuqSz"AAJJuqz"JJs3uqS1~q123AA' q*1**( S>r   )MonTueWedThuFriSatSun)NJanFebMarAprMayJunJulAugSepOctNovDecc           	      \    SSK JnJ n  U" 5       nU" XP-   5      u	  pgpppnSX   XU   XiX4-  $ )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zs                  r   _getdater  3  sE    !
&C-3CL-A*D""0OSE"2DbEF Fr   c            	           \ rS rSrSrSSSSSSS	S
S.r\" SS	/5      rS rS r	S r
\4S jrSS jr\r\" 5       S 5       rSS jrSS jrSrg)Morseli;  ay  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                     S =U l         =U l        U l        U R                   H  n[        R
                  " XS5        M     g )Nr   )keyvaluecoded_value	_reservedr   __setitem__)selfr  s     r   __init__Morsel.__init__^  s8    37774: 0 >>CT+ "r   c                     UR                  5       nXR                  ;  a  [        SU-  5      e[        R                  " XU5        g )NzInvalid Attribute %s)lowerr  r   r   r  )r   KVs      r   r  Morsel.__setitem__f  s8    GGINN"4q899!$r   c                 <    UR                  5       U R                  ;   $ r   )r$  r  )r   r%  s     r   isReservedKeyMorsel.isReservedKeyl  s    wwyDNN**r   c                    ^ UR                  5       U R                  ;   a  [        SU-  5      e[        U4S jU 5       5      (       a  [        SU-  5      eXl        X l        X0l        g )Nz!Attempt to set a reserved key: %sc              3   ,   >#    U  H	  oT;  v   M     g 7fr   r   r   s     r   r   Morsel.set.<locals>.<genexpr>t  s     0Cq
"Cr   zIllegal key value: %s)r$  r  r   anyr  r  r  )r   r  val	coded_valr   s       `r   set
Morsel.seto  s\     99;$..(ACGHH0C0005;<< 
$r   Nc                 2    U< SU R                  U5      < 3$ )Nr   )OutputString)r   attrsheaders      r   outputMorsel.output|  s     $"3"3E":;;r   c                    [         (       a5  [        U R                  [        5      (       a  [	        U R                  5      nOU R                  nSU R
                  R                  < S[	        U R                  5      < S[        U5      < S3$ )N<: =>)	r   
isinstancer  unicoder
   	__class__r   r  reprr   r/  s     r   __repr__Morsel.__repr__  sV    3:djj'22djj/C**C $ 7 7 #DHHtCy: 	:r   c                 J    SU R                  U5      R                  SS5      -  $ )Nz
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s";
        // end hiding -->
        </script>
        r>   r?   )r4  replace)r   r5  s     r   	js_outputMorsel.js_output  s.       '//U;= 	=r   c                    / nUR                   nU" U R                  < SU R                  < 35        Uc  U R                  n[	        U R                  5       5      nU H  u  pVUS:X  a  M  XQ;  a  M  US:X  a<  [        U[        5      (       a'  U" U R                  U   < S[        U5      < 35        MV  US:X  a1  [        U[        5      (       a  U" SU R                  U   U4-  5        M  US:X  a   U" [        U R                  U   5      5        M  US:X  a   U" [        U R                  U   5      5        M  U" U R                  U   < SU< 35        M     [        U5      $ )Nr<  r   r  r  z%s=%dr  r  )r   r  r  r  sorteditemsr>  r	   r  r
   _semispacejoin)r   r5  resultr   rK  r  r  s          r   r4  Morsel.OutputString  s%     	$((D$4$456 =NNEtzz|$JC{iJuc$:$:$.."5xGH	!j&<&<w$.."5u!==>s4>>#./0
"s4>>#./0$.."5u=>  " f%%r   )r  r  r  )NSet-Cookie:r   )r   r   r   r   __doc__r  r1  _flagsr!  r  r)  _LegalCharsr7  __str__r   rC  rG  r4  r   r   r   r   r  r  ;  s|    , 	I (J'(F,%+ 3> %< G_: :=&r   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                   ~    \ rS rSrSrS rS rSS jrS rS r	SS	 jr
\
r\" 5       S
 5       rSS jrS r\4S jrSrg)r   i  z'A container class for a set of Morsels.c                     X4$ )zreal_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   rB  s     r   value_decodeBaseCookie.value_decode  s     xr   c                     [        U5      nX"4$ )zreal_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/  strvals      r   value_encodeBaseCookie.value_encode  s     S~r   Nc                 6    U(       a  U R                  U5        g g r   )load)r   inputs     r   r!  BaseCookie.__init__  s    IIe r   c                     U R                  U[        5       5      nUR                  XU5        [        R                  " XU5        g)z+Private method for setting a cookie's valueN)r   r  r1  r   r  )r   r  
real_valuer  Ms        r   __setBaseCookie.__set  s2    HHS&(#	c{+A&r   c                 N    U R                  U5      u  p4U R                  XU5        g)zDictionary style assignment.N)r[  _BaseCookie__set)r   r  r  rvalcvals        r   r  BaseCookie.__setitem__  s"    &&u-


3d#r   c                     / n[        U R                  5       5      nU H%  u  pgUR                  UR                  X5      5        M'     UR	                  U5      $ )z"Return a string suitable for HTTP.)rJ  rK  r   r7  join)r   r5  r6  seprM  rK  r  r  s           r   r7  BaseCookie.output  sG    tzz|$JCMM%,,u56  xxr   c                    / n[        U R                  5       5      nU H{  u  p4[        (       a5  [        UR                  [
        5      (       a  [        UR                  5      nOUR                  nUR                  [        U5      < S[        U5      < 35        M}     SU R                  R                  < S[        U5      < S3$ )Nr<  r:  r;  r=  )rJ  rK  r   r>  r  r?  r
   r   rA  r@  r   
_spacejoin)r   lrK  r  r  r/  s         r   rC  BaseCookie.__repr__  s    tzz|$JCsz%++w77%++&kkHHC$s)45   "^^44jmDDr   c                     / n[        U R                  5       5      nU H%  u  pEUR                  UR                  U5      5        M'     [	        U5      $ )z(Return a string suitable for JavaScript.)rJ  rK  r   rG  r   )r   r5  rM  rK  r  r  s         r   rG  BaseCookie.js_output  sC    tzz|$JCMM%//%01    r   c                     [        U[        5      (       a  U R                  U5        gUR                  5        H	  u  p#X0U'   M     g)zLoad 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_stringrK  )r   rawdatar  r  s       r   r^  BaseCookie.load  sB     gs##(
 	 &mmo
!S	 .r   c                 H   Sn[        U5      nS nSUs=::  a  U:  Ga  O  g UR                  X5      nU(       d  g UR                  S5      UR                  S5      pUR                  S5      nUS   S:X  a  U(       a  XUSS  '   OUR	                  5       [
        R                  ;   a?  U(       a7  Uc'  UR	                  5       [
        R                  ;   a  SXW'   O:[        U5      XW'   O,Ub)  U R                  U5      u  pU R                  XyU
5        X   nSUs=::  a  U:  a  M  g   g g )Nr   r  r/  $r   T)r   r   groupendr$  r  r  rQ  r   rV  rg  )r   r   pattr   r   rc  matchr  r  rh  ri  s              r   __parse_stringBaseCookie.__parse_string&  s    J1jqjKK)EU+U[[-?		!A 1v} !&c!"gJ 0 00}99;&--7%)AF!)%"!..u5


3d+I9 1jqjjr   r   r   )NrO  z
)r   r   r   r   rP  rV  r[  r!  rg  r  r7  rS  r   rC  rG  r^  _CookiePatternrv  r   r   r   r   r   r     sT    1'$
  G_	E 	E! *8 !r   r   c                   $    \ rS rSrSrS rS rSrg)r   iJ  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                     [        U5      U4$ r   )r   rB  s     r   rV  SimpleCookie.value_decodeQ  s    }c!!r   c                 2    [        U5      nU[        U5      4$ r   )r
   r   rY  s      r   r[  SimpleCookie.value_encodeT  s    Svf~%%r   r   N)r   r   r   r   rP  rV  r[  r   r   r   r   r   r   J  s    "&r   r   ))rP  
__future__r   r   r   r   future.builtinsr   r   r	   r
   future.utilsr   r   reASCIIstring__all__rl  r   rL  rp  	Exceptionr   ascii_lettersdigitsrR  r   r   compiler   r   r   _weekdayname
_monthnamer  r  _LegalCharsPattr  r   r   r   r   r   <module>r     s1	  NZv ( %  & / / +
 
BH 
7GG	XX

	) 	 ((6==8;MM?
W??*07?
W??*07? W? ? +17? W	? 	? +17	?
 W?
 ?
 +17? W? ? +17? W? ? +17? W? ? +17? W? ? +17? W? ? +17? W? ?  '!?  !?$ %%?$ f%?( W)?( )?( +17)?* W+?* +?* +17+?, W-?, -?, +17-?. W/?. /?. +17/?0 W1?0 1?0 +171?2 W3?2 3?2 +173?4 W5?4 5?4 +175?6 W7?6 7?6 +177?8 W9?8 9?8 +179?: W;?: ;?: +17;?< W=?< =?< +17=?> W??> ??> +17??@ WA?@ A?@ +17A?B WC?B C?B +17C?D WE?D E?D +17E?F WG?F G?F +17G?H WI?H I?H +17I?J WK?J K?J +17K?L WM?L M?L +17M?N WO?N O?N +17O?P WQ?P Q?P +17Q?R WS?R S?R +17S?T WU?T U?T +17U?V WW?V W?V +17W?X WY?X Y?X +17Y?Z W[?Z [?Z +17[?\ W]?\ ]?\ +17]?^ W_?^ _?^ +17_?` Wa?` a?` +17a?b Wc?b c?b +17c?d We?d e?d +17e?f Wg?f g?f +17g?h Wi?h i?h +17i?j Wk?j k?j +17k?l Wm?l m?l +17m?n Wo?n o?n +17o?p Wq?p q?p +17q?r Ws?r s?r +17s?t Wu?t u?t +17u?v 7777}?B ' 
I ZZ,-
ZZ!
)d A8
 <: Fw&T w&F E  	 " 
#.q qh&: &r   