bg7dZddlmZddlmZddlmZddlmZddlmZm Z m Z gdZ ddl Z ddl Z ejrde _ddlZddlZddlZddlZdd lmZdd lmZmZddlZdd lmZdd lmZdd lmZ ddlm!Z!ddlm"Z"m#Z#m$Z$ddl%m&Z'ddl(m)Z)m*Z*ddl+m,Z,dZ-dZ.dZ/dZ0dZ1e j2dZ3e j2dZ4e j2dj5Z6dZ7d0dZ8dZ9e j2de j:e j;zZd2d"Z?d3d#Z@d$ZAd%ZBd&Zd'ZCd3d(ZDe j2d)e jZEd*ZF d4d-ZGd5d/ZHdS)6zMiscellaneous utilities.)unicode_literals)division)absolute_import)utils)bytesintstr)collapse_rfc2231_value decode_paramsdecode_rfc2231encode_rfc2231 formataddr formatdateformat_datetime getaddresses make_msgid mktime_tz parseaddr parsedate parsedate_tzparsedate_to_datetimeunquoteN)datetime)quoter)StringIO)r) AddressList)r)rr _parsedate_tz) decodestring)_bencode_qencode)Charsetz, z 'z[][\\()<>@,:;".]z[\\"]u'([^-]|\A)[-]([^-]|\Z)cZ|dd}|ddS)Nasciisurrogateescapereplace)encodedecode)stringoriginal_bytess m/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/future/backports/email/utils.py _sanitizer-Hs,]]7,=>>N  ) 4 44utf-8c|\}}|d|r |dd}t|rd}td|}|||d|dS#t $rDt |trt|}| |}|d|dcYSwxYw|S)aThe inverse of parseaddr(), this takes a 2-tuple of the form (realname, email_address) and returns the string value suitable for an RFC 2822 From, To or Cc header. If the first element of pair is false, then the second element is returned unmodified. Optional charset if given is the character set that is used to encode realname in case realname is not ASCII safe. Can be an instance of str or a Charset-like object which has a header_encode method. Default is 'utf-8'. r%r""z\\\g<0>z <>) r( specialsresearch escapesresubUnicodeEncodeError isinstancer r! header_encode)paircharsetnameaddressquotes encoded_names r,rrPsMD' NN7 C C KK F  && ==T22D$*FDD&&&'''B B" 7 7 7'3'' +!'**"0066L , ggg6 6 6 6  7 NsA88A CCcbt|}t|}|jS)z7Return a list of (REALNAME, EMAIL) for each fieldvalue.) COMMASPACEjoin _AddressList addresslist) fieldvaluesallas r,rrrs( //+ & &CSA =r.a_ =\? # literal =? (?P[^?]*?) # non-greedy up to the next ? is the charset \? # literal ? (?P[qb]) # either a "q" or a "b", case insensitive \? # literal ? (?P.*?) # non-greedy up to the next ?= is the atom \?= # literal ?= c dgd|d|dgd|ddz |d|d|d |d |fzS) Nz"%s, %02d %s %04d %02d:%02d:%02d %s)MonTueWedThuFriSatSun) JanFebMarAprMayJunJulAugSepOctNovDecr) timetuplezones r,_format_timetuple_and_zoneresj /999)A,G!  3 3 33-B B BDEE E  {{4   %c4 0 00r.c (tj}tjdtj|}tj}t jd}|d}nd|z}|tj}d|d|d||d|d }|S) anReturns a string suitable for RFC 2822 compliant Message-ID, e.g: <20020201195627.33539.96671@nightshade.la.mastaler.com> Optional idstring if given is a string used to strengthen the uniqueness of the message id. Optional domain if given provides the portion of the message id after the '@'. It defaults to the locally defined hostname. z %Y%m%d%H%M%SiNr".<@r2) rmrrtosgetpidrandom randrangesocketgetfqdn)idstringdomainruutcdatepidrandintmsgids r,rrsikkGmNDK,@,@AAG )++Cv&&G> ~!!!(###ww&&& IE Lr.c tt|}|ddg|ddz\}}|tj|ddStj|dddtjtj|iS)NrgrPr}seconds)listrrrq timedelta)data _3to2listdtupletzs r,rrs]4(())ISbS>"Yrss^3KFB z &!*--  fRaRj F$X%7%C%C%CDD F FFr.cBt|j}|sdS|dS)N)r"r"r)rCrD)addraddrss r,rrs(    *E v 8Or.c$t|dkr||jdrB|jdr2|ddddddS|jdr|jdr |ddS|S) zRemove quotes from a string.r^r1rgz\\\z\"rr2)len startswithendswithr')r s r,rrs 3xx!|| 3>#   G<3<#4#4 Gqt9$$VT22::5#FF F 3>#   <3<#4#4 qt9  Jr.cl|td}t|dkrdd|fS|S)z#Decode string according to RFC 2231rQN)splitTICKr)spartss r,r r s5 GGD!  E 5zzQT1} Lr.cRt|d|pd}|||S|d}|d|d|S)zEncode string according to RFC 2231. If neither charset nor language is given, then s is returned as-is. If charset is given but not language, the string is encoded using the empty string for language. r"r%)safeencodingNr#) url_quote)rr;languages r,r r sN !"w'9':::A8+ (((AA ..r.z&^(?P\w+)\*((?P[0-9]+)\*?)?$c|dd}g}i}|d\}}|||f|r|d\}}|drd}nd}t|}t|}|rW|dd\}}|t|}||g|||fn'||dt|zf||r| D]\}}g}d} | |D]0\}} }|rt| d } d} || 1tt|}| r1t|\} } }||| | d|zff||d|zf|S) zDecode parameters list according to RFC 2231. params is a sequence of 2-tuples containing (param name, string value). Nr*TFr<numz"%s"zlatin-1)r)popappendrrrfc2231_continuationmatchgroupr setdefaultritemssort url_unquote EMPTYSTRINGrBr ) params new_paramsrfc2231_paramsr<valueencodedmor continuationsextendedrr;rs r,r r s? AAAYFJN**Q--KD%tUm$$$ =jjmm e ==   GGG ! ' ' - -  =//ID##hh  % %dB / / 6 6UG7L M M M M   tVeEll%:; < < < =:#1#7#7#9#9 : : D-EH    $1  Q$$A :::A#H Q+**51122E :+9%+@+@(5!!4'8Ve^)L"MNNNN!!4%"89999 r.r'us-asciict|trt|dkrt|S|\}}}t |d} t |||S#t $rt|cYSwxYw)Nr_zraw-unicode-escape)r8tuplerrrr LookupError)rerrorsfallback_charsetr;rtextrawbytess r,r r Us eU # #s5zzQu~~$GXtT/00H8Wf--- t}}sA A<;A<rgcd|@tjtjjS|j|S|dd|fz}tj|}tj |} tj |j }tj||j }n#t$r|tjtj|ddz }tjo |jdk}|r tjn tj }|tj |kr&tj|tj|}ntj|}YnwxYw||S)aReturn local time as an aware datetime object. If called without arguments, return current time. Otherwise *dt* argument should be a datetime instance, and it is converted to the local time zone according to the system time zone database. If *dt* is naive (that is, dt.tzinfo is None), it is assumed to be in local time. In this case, a positive or zero value for *isdst* causes localtime to presume initially that summer time (for example, Daylight Saving Time) is or is not (respectively) in effect for the specified time. A negative value for *isdst* causes the localtime() function to attempt to divine whether summer time is in effect for the specified time. NrgrrPr)r})rrwrqr~ astimezoner}rcrmmktimernr tm_gmtofftm_zoneAttributeErrorrtrotm_isdstrptznamer') risdsttmrlocaltmdeltardstgmtoffs r,rnrnks{ z $$X%6%:;;FFHHH y}}  x 'Bk"ooGnW%%G *"7+<===  ugo 6 6  * * *X& G(<(rsb ''''''&&&&&&++++++++++   $ 9BH %%%%%%TTTTTTTT333333IIIIII777777TTTTTTTTTT++++++?>>>>>>>222222       RZ+ , , BJx "*?AAAG 555Drz zBM!##+1+1+1+1Z1111&0FFF / / / /"rz"KH666p*3,6    ,%!%!%!%!%!%!r.