ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/utils.cpython-33.pyc

�
��f�6c@s�dZddddddddd	d
ddd
ddgZddlZddlZddlZddlZddlZddlZddlZddl	Z
ddlZddlm
Z
ddlmZddlmZddlmZddlmZmZmZddlmZddlmZmZddlmZdZdZdZ dZ!dZ"ej#d�Z$ej#d�Z%ej#d �j&Z'd!d"�Z(d#d$d�Z)d%d�Z*ej#d&ej+ej,B�Z-d'd(�Z.dd9d9d)d�Z1d9d*d�Z2ddd+d	�Z3d,d�Z4d-d�Z5d.d�Z6d/d�Z7ddd0d�Z8ej#d1ej9�Z:d2d�Z;d3d4d5d�Z<dd:d7d8�Z=dS(;uMiscellaneous utilities.ucollapse_rfc2231_valueu
decode_paramsudecode_rfc2231uencode_rfc2231u
formataddru
formatdateuformat_datetimeugetaddressesu
make_msgidu	mktime_tzu	parseaddru	parsedateuparsedate_tzuparsedate_to_datetimeuunquoteiN(uStringIO(uquote(uAddressList(u	mktime_tz(u	parsedateuparsedate_tzu
_parsedate_tz(udecodestring(u_bencodeu_qencode(uCharsetu, uu
u'u[][\\()<>@,:;".]u[\\"]u'([^�-�]|\A)[�-�]([^�-�]|\Z)cCs"|jdd�}|jdd�S(Nuasciiusurrogateescapeureplace(uencodeudecode(ustringuoriginal_bytes((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu	_sanitize@su	_sanitizeuutf-8c
Cs�|\}}|jd�|r�y|jd�WnMtk
rt|t�r^t|�}n|j|�}d||fSYq�Xd}tj|�r�d}ntj	d|�}d||||fSn|S(u�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'.
    uasciiu%s <%s>uu"u\\\g<0>u%s%s%s <%s>(
uencodeuUnicodeEncodeErroru
isinstanceustruCharsetu
header_encodeu
specialsreusearchu	escapesreusub(upairucharsetunameuaddressuencoded_nameuquotes((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu
formataddrHs 


	cCs"tj|�}t|�}|jS(u7Return a list of (REALNAME, EMAIL) for each fieldvalue.(u
COMMASPACEujoinu_AddressListuaddresslist(ufieldvaluesuallua((u0/opt/alt/python33/lib64/python3.3/email/utils.pyugetaddressesjsu_
  =\?                   # 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 ?=
  cCs�ddddddddg|d	|d
ddd
dddddddddg|dd|d|d|d|d|fS(Nu"%s, %02d %s %04d %02d:%02d:%02d %suMonuTueuWeduThuuFriuSatuSuniiuJanuFebuMaruApruMayuJunuJuluAuguSepuOctuNovuDeciiiii((u	timetupleuzone((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu_format_timetuple_and_zone}s !u_format_timetuple_and_zonec	Cs�|d
krtj�}n|r�tj|�}tjrO|drOtj}n	tj}tt|�d�\}}|dkr�d}nd}d|||df}n$tj|�}|r�d}nd	}t	||�S(u�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.
    iiiu-u+u
%s%02d%02di<uGMTu-0000Ni����(
uNoneutimeu	localtimeudaylightualtzoneutimezoneudivmoduabsugmtimeu_format_timetuple_and_zone(	utimevalu	localtimeuusegmtunowuoffsetuhoursuminutesusignuzone((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu
formatdate�s"			cCs�|j�}|rN|jdks6|jtjjkrEtd��nd}n'|jdkrfd}n|jd�}t||�S(u$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.
    u%usegmt option requires a UTC datetimeuGMTu-0000u%zN(	u	timetupleutzinfouNoneudatetimeutimezoneuutcu
ValueErrorustrftimeu_format_timetuple_and_zone(udtuusegmtunowuzone((u0/opt/alt/python33/lib64/python3.3/email/utils.pyuformat_datetime�s$		cCs�tj�}tjdtj|��}tj�}tjd�}|dkrWd}n
d|}|dkr|tj	�}nd|||||f}|S(unReturns 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.
    u%Y%m%d%H%M%Si��uu.u<%s.%s.%s%s@%s>N(
utimeustrftimeugmtimeuosugetpidurandomu	randrangeuNoneusocketugetfqdn(uidstringudomainutimevaluutcdateupidurandintumsgid((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu
make_msgid�s
	
cCsgt|�^}}|dkr5tj|dd��Stjdtjtjd|��|dd��S(Niutzinfouseconds(u
_parsedate_tzuNoneudatetimeutimezoneu	timedelta(udataudtupleutz((u0/opt/alt/python33/lib64/python3.3/email/utils.pyuparsedate_to_datetime�s
	cCs!t|�j}|sdS|dS(Nui(uu(u_AddressListuaddresslist(uaddruaddrs((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu	parseaddr�scCs�t|�dkr�|jd�rV|jd�rV|dd�jdd�jdd�S|jd�r�|jd�r�|dd	�Sn|S(
uRemove quotes from a string.iu"u\\u\u\"u<u>i����i����(ulenu
startswithuendswithureplace(ustr((u0/opt/alt/python33/lib64/python3.3/email/utils.pyuunquote�s&cCs5|jtd�}t|�dkr1dd|fS|S(u#Decode string according to RFC 2231iN(usplituTICKulenuNone(usuparts((u0/opt/alt/python33/lib64/python3.3/email/utils.pyudecode_rfc2231�s
cCsftjj|ddd|pd�}|dkr@|dkr@|S|dkrUd}nd|||fS(u�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.
    usafeuuencodinguasciiu%s'%s'%sN(uurllibuparseuquoteuNone(usucharsetulanguage((u0/opt/alt/python33/lib64/python3.3/email/utils.pyuencode_rfc2231s$	u&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c
Cs|dd�}g}i}|jd�\}}|j||f�x�|r|jd�\}}|jd�rzd	}nd
}t|�}tj|�}|r�|jdd�\}}|dk	r�t
|�}n|j|g�j|||f�qG|j|dt|�f�qGW|rx�|j
�D]�\}}g}d
}	|j�xK|D]C\}}
}|r�tjj|
dd�}
d	}	n|j|
�qVWttj|��}|	r�t|�\}}}|j|||d|ff�q-|j|d|f�q-Wn|S(uDecode parameters list according to RFC 2231.

    params is a sequence of 2-tuples containing (param name, string value).
    Niu*unameunumu"%s"uencodingulatin-1TF(upopuappenduendswithuTrueuFalseuunquoteurfc2231_continuationumatchugroupuNoneuintu
setdefaultuquoteuitemsusortuurllibuparseuEMPTYSTRINGujoinudecode_rfc2231(
uparamsu
new_paramsurfc2231_paramsunameuvalueuencodedumounumu
continuationsuextendedusucharsetulanguage((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu
decode_paramssD		%!
	#ureplaceuus-asciicCs�t|t�s"t|�dkr,t|�S|\}}}|dkrP|}nt|d�}yt|||�SWntk
r�t|�SYnXdS(Niuraw-unicode-escape(u
isinstanceutupleulenuunquoteuNoneubytesustruLookupError(uvalueuerrorsufallback_charsetucharsetulanguageutexturawbytes((u0/opt/alt/python33/lib64/python3.3/email/utils.pyucollapse_rfc2231_valueLs"
	
ic	Csi|dkr(tjjtjj�j�S|jdk	rA|j�S|j�dd�|f}tj	|�}tj
|�}y.tjd|j�}tj||j
�}Wn�tk
rX|tjtj|�dd��}tjo�|jdk}|rtjntj}|tjd|�krEtj|tj|�}ntj|�}YnX|jd|�S(u�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.

    Niusecondsiiutzinfoi����(uNoneudatetimeunowutimezoneuutcu
astimezoneutzinfou	timetupleutimeumktimeu	localtimeu	timedeltau	tm_gmtoffutm_zoneuAttributeErrorugmtimeudaylightutm_isdstualtzoneutznameureplace(	udtuisdstutmusecondsulocaltmudeltautzudstugmtoff((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu	localtimefs$

&u	localtimeFi����(>u__doc__u__all__uosureutimeubase64urandomusocketudatetimeuurllib.parseuurllibuwarningsuiouStringIOuemail._parseaddruquoteuAddressListu_AddressListu	mktime_tzu	parsedateuparsedate_tzu
_parsedate_tzuquopriudecodestringu_qdecodeuemail.encodersu_bencodeu_qencodeu
email.charsetuCharsetu
COMMASPACEuEMPTYSTRINGuUEMPTYSTRINGuCRLFuTICKucompileu
specialsreu	escapesreusearchu_has_surrogatesu	_sanitizeu
formataddrugetaddressesuVERBOSEu
IGNORECASEuecreu_format_timetuple_and_zoneuNoneuFalseu
formatdateuformat_datetimeu
make_msgiduparsedate_to_datetimeu	parseaddruunquoteudecode_rfc2231uencode_rfc2231uASCIIurfc2231_continuationu
decode_paramsucollapse_rfc2231_valueu	localtime(((u0/opt/alt/python33/lib64/python3.3/email/utils.pyu<module>sz	"	-	8

Zerion Mini Shell 1.0