Viewing File: /opt/alt/python311/lib64/python3.11/email/__pycache__/utils.cpython-311.pyc
f4 d Z g dZddlZddlZddlZddlZddlZddlZddlZ ddl
mZ ddl
mZ
ddl
mZ ddl
mZmZmZ ddlmZ d Zd
Zd
ZdZdZ ej d
Z ej d Zd Zd Zd%dZd Zd Z d&dZ!d'dZ"d(dZ#d Z$d Z%d Z&d Z'd(dZ( ej dej) Z*d Z+ d)d"Z,d*d$Z-dS )+zMiscellaneous utilities.)collapse_rfc2231_value
decode_paramsdecode_rfc2231encode_rfc2231
formataddr
formatdateformat_datetimegetaddresses
make_msgid mktime_tz parseaddr parsedateparsedate_tzparsedate_to_datetimeunquote N)quote)AddressList)r )r
r
_parsedate_tz)Charsetz, z
'z[][\\()<>@,:;".]z[\\"]c R | dS # t $ r Y dS w xY w)z;Return True if s may contain surrogate-escaped binary data.FT)encodeUnicodeEncodeError)ss 2/opt/alt/python311/lib64/python3.11/email/utils.py_has_surrogatesr 3 s;
u tts
&&c Z | dd }| dd S )Nutf-8surrogateescapereplace)r decode)stringoriginal_bytess r _sanitizer% @ s.
]]7,=>>N )444 r c | \ }}| d |r | d d}t | rd}t d| }|||d|dS # t
$ rD t
|t rt | }| | }|d|dcY S w xY w|S )a The 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)paircharsetnameaddressquotesencoded_names r r r L s MD'NN7
C CKK F &&