python (3.12.0)

(root)/
lib/
python3.12/
email/
__pycache__/
utils.cpython-312.pyc

ˑe/dZgdZddlZddlZddlZddlZddlZddlZddlZ	ddl
mZddl
mZ
ddl
mZddl
mZmZmZddlmZd	Zd
Zd
ZdZdZej2d
Zej2dZdZdZd dZdZdZ d!dZ!d"dZ"d#dZ#dZ$dZ%dZ&dZ'd#dZ(ej2dejRZ*dZ+		d$dZ,d#dZ-y)%zMiscellaneous utilities.)collapse_rfc2231_value
decode_paramsdecode_rfc2231encode_rfc2231
formataddr
formatdateformat_datetimegetaddresses
make_msgid	mktime_tz	parseaddr	parsedateparsedate_tzparsedate_to_datetimeunquoteN)quote)AddressList)r)r
r
_parsedate_tz)Charsetz, z
'z[][\\()<>@,:;".]z[\\"]cD	|jy#t$rYywxYw)z8Return True if s contains surrogate-escaped binary data.FT)encodeUnicodeEncodeError)ss ?/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/email/utils.py_has_surrogatesr3s%
	
s	cJ|jdd}|jddS)Nutf-8surrogateescapereplace)rdecode)stringoriginal_bytess  r	_sanitizer%@s(
]]7,=>N  )44cV|\}}|jd|rM	|jdd}tj|rd}tj	d|}|||d|dS|S#t
$r7t
|trt|}|j|}|d|dcYSwxYw)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.

    The optional charset 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'.
    asciir"z\\\g<0>z <>)
r
specialsresearch	escapesresubr
isinstancestrr
header_encode)paircharsetnameaddressquotesencoded_names      rrrLsMD'NN7	CKK F  &==T2D$*D&'BBN"	7'3'!'*"006L ,g66		7sA((=B('B(chtjd|D}t|}|jS)z7Return a list of (REALNAME, EMAIL) for each fieldvalue.c32K|]}t|yw)Nr0).0vs  r	<genexpr>zgetaddresses.<locals>.<genexpr>ps6Q#a&6s)
COMMASPACEjoin_AddressListaddresslist)fieldvaluesallas   rr	r	ns*
//6+6
6CSA==r&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_zonerbusZ/9)A,G!	33<Q<!3C	E!ilIaL)A,
3r&c|tj}tjj|tjj}|r|j}d}n|s|j
d}t||S)aReturns a date string as specified by RFC 2822, e.g.:

    Fri, 09 Nov 2001 01:08:47 -0000

    Optional timeval if given is a floating point time value as accepted by
    gmtime() and localtime(), otherwise the current time is used.

    Optional localtime is a flag that when True, interprets timeval, and
    returns a date relative to the local timezone instead of UTC, properly
    taking daylight savings time into account.

    Optional argument usegmt means that the timezone is written out as
    an ascii string, not numeric one (so "GMT" instead of "+0000"). This
    is needed for HTTP, and is only used when localtime==False.
    NF)tzinfo)timedatetime
fromtimestamptimezoneutc
astimezoner!r)timeval	localtimeusegmtdts    rrr~sk$))+				(	((2C2C2G2G	HB
]]_

ZZtZ
$2v&&r&c|j}|rA|j'|jtjjk7rtdd}n |jd}n|j
d}t||S)a$Turn a datetime into a date string as specified in RFC 2822.

    If usegmt is True, dt must be an aware datetime with an offset of zero.  In
    this case 'GMT' will be rendered instead of the normal +0000 required by
    RFC2822.  This is to support HTTP headers involving date stamps.
    z%usegmt option requires a UTC datetimeGMTz-0000z%z)r`rdrfrhri
ValueErrorstrftimerb)rnrmnowras    rrrsn
,,.C

99		X->->-B-B BDEE		{{4 %c400r&cttjdz}tj}t	j
d}|d}nd|z}|t
j}d|||||fz}|S)a{Returns a string suitable for RFC 2822 compliant Message-ID, e.g:

    <142480216486.20800.16526388040877946887@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.
    d@r.z<%d.%d.%d%s@%s>)intreosgetpidrandomgetrandbitssocketgetfqdn)idstringdomainrkpidrandintmsgids      rr
r
sr$))+c/"G
))+C  $G>
~!#w& IIELr&c	t|}|tdt|z|^}}|tj|ddStj|dddtjtj
|iS)Nz!Invalid date value or format "%s"rMrd)seconds)rrqr0rfrh	timedelta)dataparsed_date_tzdtupletzs    rrrs"4(N<s4yHII KVR	z  &!*--fRajF$$X%7%7%CDFFr&c<t|j}|sy|dS)z
    Parse addr into its constituent realname and email address parts.

    Return a tuple of realname and email address, unless the parse fails, in
    which case return a 2-tuple of ('', '').
    )rrr)r@rA)addraddrss  rrrs#
**E8Or&ct|dkDrn|jdr6|jdr%|ddjddjddS|jdr|jdr|ddS|S)	zRemove quotes from a string.r[r)z\\\z\"<r*)len
startswithendswithr!r:s rrrsr
3x!|>>#3<<#4q9$$VT2::5#FF>>#3<<#4q9Jr&cX|jtd}t|dkrdd|fS|S)z#Decode string according to RFC 2231rNN)splitTICKr)rpartss  rrrs.
GGD!E
5zQT1}Lr&cvtjj|d|xsd}|||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.
    rr()safeencodingr)urllibparser)rr3languages   rrrsK	120B7CA8+ (A..r&z&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c|dg}i}|ddD]\}}|jd}t|}tj|}|rG|j	dd\}}|t|}|j
|gj|||f|j|dt|zf|r|jD]\}}g}d}	|j|D]<\}}
}|r#tjj|
d	
}
d}	|j|
>ttj|}|	r)t|\}}}|j|||d|zff|j|d|zf|S)zDecode parameters list according to RFC 2231.

    params is a sequence of 2-tuples containing (param name, string value).
    rr[N*r4numz"%s"Fzlatin-1)rT)rrrfc2231_continuationmatchgrouprx
setdefaultappendritemssortrrEMPTYSTRINGr?r)
params
new_paramsrfc2231_paramsr4valueencodedmor
continuationsextendedrr3rs
             rrrs
)JNabz
=e--$
!
'
'
-
/ID##h%%dB/66UG7LMtVeEl%:;<
=#1#7#7#9	:D-EH $1
 Q,,Q,CA#HQ
 +**512E+9%+@(5!!4'8Ve^)L"MN!!4%"89/	:0r&ct|trt|dk7rt|S|\}}}||}t	|d}	t|||S#t$rt|cYSwxYw)Nr\zraw-unicode-escape)r/tuplerrbytesr0LookupError)rerrorsfallback_charsetr3rtextrawbytess       rrr4steU#s5zQu~$GXt#T/0H8Wf--t}sAA%$A%c|ddl}|jddd|tjj}|j	S)a}Return 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.
    The isdst parameter is ignored.

    Nrz$The 'isdst' parameter to 'localtime'z>{name} is deprecated and slated for removal in Python {remove})r\)messageremove)warnings_deprecatedrfrsrj)rnisdstrs   rrlrlNsP
2T		

z



"
"
$
==?r&)r)NFF)F)NN)r!zus-ascii).__doc____all__ryrerer{r}rfurllib.parseremail._parseaddrrrr@rr
rr
email.charsetrr>rUEMPTYSTRINGCRLFrcompiler+r-rr%rr	rbrrr
rrrrrASCIIrrrrlr_r&r<module>rs
$
	

"8&CC"




RZZ+
,
BJJx 		5D':1&.F
/"rzz"KHH.`*3,64r&