AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.148.102.84
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.6/email/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib64/python3.6/email/__pycache__/utils.cpython-36.pyc
3


 \I6�@s~dZddddddddd	d
ddd
ddgZddlZddlZddlZddlZddlZddlZddlZ	ddl
mZddl
mZ
ddl
mZddl
mZmZmZddlmZdZdZdZdZdZejd�Zejd�Zdd�Zdd �Zd8d"d�Zd#d�Zejd$ej ej!B�Z"d%d&�Z#d9d(d�Z$d:d)d�Z%d;d*d	�Z&d+d�Z'd,d�Z(d-d�Z)d.d�Z*d<d/d�Z+ejd0ej,�Z-d1d�Z.d=d4d�Z/d?d6d7�Z0dS)@zMiscellaneous utilities.�collapse_rfc2231_value�
decode_params�decode_rfc2231�encode_rfc2231�
formataddr�
formatdate�format_datetime�getaddresses�
make_msgid�	mktime_tz�	parseaddr�	parsedate�parsedate_tz�parsedate_to_datetime�unquote�N)�quote)�AddressList)r
)rr
�
_parsedate_tz)�Charsetz, �z
�'z[][\\()<>@,:;".]z[\\"]cCs&y|j�dStk
r dSXdS)z8Return True if s contains surrogate-escaped binary data.FTN)�encode�UnicodeEncodeError)�s�r�/usr/lib64/python3.6/utils.py�_has_surrogates3s
rcCs|jdd�}|jdd�S)Nzutf-8�surrogateescape�replace)r�decode)�stringZoriginal_bytesrrr�	_sanitize@sr!�utf-8c
Cs�|\}}|jd�|r�y|jd�Wn8tk
r\t|t�rFt|�}|j|�}d||fSXd}tj|�rpd}tj	d|�}d||||fS|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.

    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'.
    �asciiz%s <%s>r�"z\\\g<0>z%s%s%s <%s>)
rr�
isinstance�strrZ
header_encode�
specialsre�search�	escapesre�sub)Zpair�charset�nameZaddressZencoded_nameZquotesrrrrLs 




cCstj|�}t|�}|jS)z7Return a list of (REALNAME, EMAIL) for each fieldvalue.)�
COMMASPACE�join�_AddressList�addresslist)Zfieldvalues�all�arrrrns
a_
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qb])    # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<atom>.*?)         # non-greedy up to the next ?= is the atom
  \?=                   # literal ?=
  cCsfddddddddg|d	|d
ddd
dddddddddg|dd|d|d|d|d|fS)Nz"%s, %02d %s %04d %02d:%02d:%02d %sZMonZTueZWedZThuZFriZSatZSun��ZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDec�r���r)�	timetuple�zonerrr�_format_timetuple_and_zone�sr;FcCsR|dkrtj�}|s|r,tjj|tjj�}ntjj|�}|rH|j�}d}t||�S)a�Returns 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)�time�datetimeZ
fromtimestamp�timezone�utcZutcfromtimestamp�
astimezoner)�timeval�	localtime�usegmt�dtrrrr�scCsV|j�}|r2|jdks$|jtjjkr,td��d}n|jdkrBd}n
|jd�}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.
    Nz%usegmt option requires a UTC datetimeZGMTz-0000z%z)r9�tzinfor=r>r?�
ValueErrorZstrftimer;)rDrC�nowr:rrrr�s

cCs^ttj�d�}tj�}tjd�}|dkr0d}nd|}|dkrHtj�}d|||||f}|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�@Nr�.z<%d.%d.%d%s@%s>)�intr<�os�getpid�randomZgetrandbits�socketZgetfqdn)ZidstringZdomainrA�pidZrandintZmsgidrrrr	�s

cCsNt|��^}}|dkr(tj|dd��Stj|dd�dtjtj|d��i�S)Nr3rE)�seconds)rr=r>�	timedelta)�dataZdtuple�tzrrrr�s
cCst|�j}|sdS|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 ('', '').
    rr)rr)r/r0)ZaddrZaddrsrrrr�s
cCs`t|�dkr\|jd�r<|jd�r<|dd�jdd�jdd�S|jd�r\|jd�r\|dd	�S|S)
zRemove quotes from a string.r5r$z\\�\z\"�<�>���rX)�len�
startswith�endswithr)r&rrrr�scCs&|jtd�}t|�dkr"dd|fS|S)z#Decode string according to RFC 2231r4N)�split�TICKrY)r�partsrrrr�s
cCsDtjj|d|pdd�}|dkr*|dkr*|S|dkr6d}d|||fS)z�Encode 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#)Zsafe�encodingNz%s'%s'%s)�urllib�parser)rr+�languagerrrr�sz&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c
Csx|dd�}g}i}|jd�\}}|j||f�x�|r�|jd�\}}|jd�rTd}nd}t|�}tj|�}|r�|jdd�\}}|dk	r�t|�}|j|g�j|||f�q2|j|dt	|�f�q2W|�rtx�|j
�D]�\}}g}d}	|j�x6|D].\}}
}|�rtj
j|
d	d
�}
d}	|j|
�q�Wt	tj|��}|	�r^t|�\}}}|j|||d|ff�q�|j|d|f�q�W|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_)�pop�appendr[r�rfc2231_continuation�match�grouprK�
setdefaultr�items�sortr`ra�EMPTYSTRINGr.r)
ZparamsZ
new_paramsZrfc2231_paramsr,�valueZencoded�mordZ
continuationsZextendedrr+rbrrrr
sD

r�us-asciicCsjt|t�st|�dkr t|�S|\}}}|dkr6|}t|d�}yt|||�Stk
rdt|�SXdS)Nr6zraw-unicode-escape)r%�tuplerYr�bytesr&�LookupError)rn�errorsZfallback_charsetr+rb�textZrawbytesrrrrEs

r5c	Cs|dkrtjjtjj�j�S|jdk	r.|j�S|j�dd�|f}tj|�}tj	|�}y tj
|jd�}tj||j�}Wn�t
k
r�|tjtj|�dd��}tjo�|jdk}|r�tjntj}|tj
|d�kr�tj|tj|�}n
tj|�}YnX|j|d�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.
    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.

    Nr5)rQr3r)rErX)r=rGr>r?r@rEr9r<ZmktimerBrRZ	tm_gmtoffZtm_zone�AttributeErrorZgmtimeZdaylightZtm_isdstZaltzoneZtznamer)	rDZisdstZtmrQZlocaltmZdeltarT�dstZgmtoffrrrrB_s$


rB)r")NFF)F)NN)NN)rrprX)NrX)1�__doc__�__all__rL�rer<rNrOr=Zurllib.parser`Zemail._parseaddrrrr/r
rr
rZ
email.charsetrr-rmZUEMPTYSTRINGZCRLFr]�compiler'r)rr!rr�VERBOSE�
IGNORECASEZecrer;rrr	rrrrr�ASCIIrgrrrBrrrr�<module>sn



"	



8


Anon7 - 2022
AnonSec Team