b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 172.67.192.52 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 / email /
Filename/usr/lib64/python2.6/email/charset.pyo
Size13.08 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 09:46
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@s¹ddddgZddkZddkZddklZddklZdZd Zd
Z d Z
d Z heedfd
6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6eedfd6dAd 6eedfd6eedfd6eddfd6eddfd6eddfd6eedfd6e edfd6dedfd 6Z
hd
d!6d
d"6dd#6dd$6dd%6dd&6dd'6dd(6dd)6dd*6dd+6dd,6dd-6dd.6dd/6dd06dd16dd26dd36dd46d5d66dd76d8d96d d:6Zhd;d6d<d6dd 6Zdddd=�Zd>�Zd?�ZddBd@��YZdS(CtCharsett add_aliast add_charsett add_codeciÿÿÿÿN(terrors(tencode_7or8bitiiiisus-asciis
iso-8859-1s
iso-8859-2s
iso-8859-3s
iso-8859-4s
iso-8859-9s iso-8859-10s iso-8859-13s iso-8859-14s iso-8859-15s iso-8859-16s windows-1252tvisciitbig5tgb2312s iso-2022-jpseuc-jpt shift_jisskoi8-rsutf-8t8bittlatin_1slatin-1tlatin_2slatin-2tlatin_3slatin-3tlatin_4slatin-4tlatin_5slatin-5tlatin_6slatin-6tlatin_7slatin-7tlatin_8slatin-8tlatin_9slatin-9tlatin_10slatin-10sks_c_5601-1987tcp949teuc_jpseuc-krteuc_krtasciit eucgb2312_cntbig5_twcCs4|tjotd��n|||ft|<dS(s>Add character set properties to the global registry.

charset is the input character set, and must be the canonical name of a
character set.

Optional header_enc and body_enc is either Charset.QP for
quoted-printable, Charset.BASE64 for base64 encoding, Charset.SHORTEST for
the shortest of qp or base64 encoding, or None for no encoding. SHORTEST
is only valid for header_enc. It describes how message headers and
message bodies in the input charset are to be encoded. Default is no
encoding.

Optional output_charset is the character set that the output should be
in. Conversions will proceed from input charset, to Unicode, to the
output charset when the method Charset.convert() is called. The default
is to output in the same character set as the input.

Both input_charset and output_charset must have Unicode codec entries in
the module's charset-to-codec mapping; use add_codec(charset, codecname)
to add codecs the module does not know about. See the codecs module's
documentation for more information.
s!SHORTEST not allowed for body_encN(tSHORTESTt
ValueErrortCHARSETS(tcharsett
header_enctbody_enctoutput_charset((s%/usr/lib64/python2.6/email/charset.pyRks
cCs|t|<dS(s�Add a character set alias.

alias is the alias name, e.g. latin-1
canonical is the character set's canonical name, e.g. iso-8859-1
N(tALIASES(taliast canonical((s%/usr/lib64/python2.6/email/charset.pyR�scCs|t|<dS(s$Add a codec that map characters in the given charset to/from Unicode.

charset is the canonical name of a character set. codecname is the name
of a Python codec, as appropriate for the second argument to the unicode()
built-in, or to the encode() method of a Unicode string.
N(t CODEC_MAP(Rt codecname((s%/usr/lib64/python2.6/email/charset.pyR�scBs�eZdZed�Zd�ZeZd�Zd�Zd�Z d�Z
d�Z e d�Z
d �Zd
�Zed �Ze d �ZRS(
s? Map character sets to their email properties.

This class provides information about the requirements imposed on email
for a specific character set. It also provides convenience routines for
converting between character sets, given the availability of the
applicable codecs. Given a character set, it will do its best to provide
information on how to use that character set in an email in an
RFC-compliant way.

Certain character sets must be encoded with quoted-printable or base64
when used in email headers or bodies. Certain character sets must be
converted outright, and are not allowed in email. Instances of this
module expose the following information about a character set:

input_charset: The initial character set specified. Common aliases
are converted to their `official' email names (e.g. latin_1
is converted to iso-8859-1). Defaults to 7-bit us-ascii.

header_encoding: If the character set must be encoded before it can be
used in an email header, this attribute will be set to
Charset.QP (for quoted-printable), Charset.BASE64 (for
base64 encoding), or Charset.SHORTEST for the shortest of
QP or BASE64 encoding. Otherwise, it will be None.

body_encoding: Same as header_encoding, but describes the encoding for the
mail message's body, which indeed may be different than the
header encoding. Charset.SHORTEST is not allowed for
body_encoding.

output_charset: Some character sets must be converted before the can be
used in email headers or bodies. If the input_charset is
one of them, this attribute will contain the name of the
charset output will be converted to. Otherwise, it will
be None.

input_codec: The name of the Python codec used to convert the
input_charset to Unicode. If no conversion codec is
necessary, this attribute will be None.

output_codec: The name of the Python codec used to convert Unicode
to the output_charset. If no conversion codec is necessary,
this attribute will have the same value as the input_codec.
cCsy4t|t�o|id�nt|d�}Wn"tj
oti|��nX|i�}ti||�|_ t
i|i t t df�\}}}|p
|i }n||_||_ti||�|_ti|i |i �|_ti|i|i�|_dS(NR(t
isinstancetunicodetencodet UnicodeErrorRt CharsetErrortlowerR"tgett
input_charsetRRtBASE64tNonetheader_encodingt
body_encodingR!R%t input_codect output_codec(tselfR.thenctbenctconv((s%/usr/lib64/python2.6/email/charset.pyt__init__Çs&  
    cCs
|ii�S(N(R.R,(R5((s%/usr/lib64/python2.6/email/charset.pyt__str__èscCst|�t|�i�jS(N(tstrR,(R5tother((s%/usr/lib64/python2.6/email/charset.pyt__eq__íscCs|i|� S(N(R=(R5R<((s%/usr/lib64/python2.6/email/charset.pyt__ne__ðscCs2|itjodS|itjodStSdS(sCReturn the content-transfer-encoding used for body encoding.

This is either the string `quoted-printable' or `base64' depending on
the encoding used, or it is a function in which case you should call
the function with a single argument, the Message object being
encoded. The function should then set the Content-Transfer-Encoding
header itself to whatever is appropriate.

Returns "quoted-printable" if self.body_encoding is QP.
Returns "base64" if self.body_encoding is BASE64.
Returns "7bit" otherwise.
squoted-printabletbase64N(R2tQPR/R(R5((s%/usr/lib64/python2.6/email/charset.pytget_body_encodingós
cCs8|i|ijot||i�i|i�S|SdS(s:Convert a string from the input_codec to the output_codec.N(R3R4R(R)(R5ts((s%/usr/lib64/python2.6/email/charset.pytconvertscCsWt|t�p|idjo|Syt||id�SWntj
o|SXdS(sêConvert a possibly multibyte string to a safely splittable format.

Uses the input_codec to try and convert the string to Unicode, so it
can be safely split on character boundaries (even for multibyte
characters).

Returns the string as-is if it isn't known how to convert it to
Unicode with the input_charset.

Characters that could not be converted to Unicode will be replaced
with the Unicode replacement character U+FFFD.
treplaceN(R'R(R3R0t LookupError(R5RB((s%/usr/lib64/python2.6/email/charset.pyt
to_splittables
cCso|o
|i}n
|i}t|t� p
|djo|Sy|i|d�SWntj
o|SXdS(s*Convert a splittable string back into an encoded string.

Uses the proper codec to try and convert the string from Unicode back
into an encoded format. Return the string as-is if it is not Unicode,
or if it could not be converted from Unicode.

Characters that could not be converted from Unicode will be replaced
with an appropriate character (usually '?').

If to_output is True (the default), uses output_codec to convert to an
encoded format. If to_output is False, uses input_codec.
RDN(R4R3R'R(R0R)RE(R5tustrt to_outputtcodec((s%/usr/lib64/python2.6/email/charset.pytfrom_splittable%s

 cCs|ip|iS(s�Return the output character set.

This is self.output_charset if that is not None, otherwise it is
self.input_charset.
(R!R.(R5((s%/usr/lib64/python2.6/email/charset.pytget_output_charset>scCsÈ|i�}|itjotii|�t|�tS|itjoti i
|�t|�tS|it jo@tii|�}ti i
|�}t ||�t|�tSt|�SdS(s/Return the length of the encoded header string.N(
RKR1R/temailt
base64mimet
base64_lentlentMISC_LENR@t
quoprimimetheader_quopri_lenRtmin(R5RBtcsettlenb64tlenqp((s%/usr/lib64/python2.6/email/charset.pytencoded_header_lenFs cCsî|i�}|o|i|�}n|itjotii||�S|itjotii||dd�S|it
jobtii |�}tii |�}||jotii||�Stii||dd�Sn|SdS(sEHeader-encode a string, optionally converting it to output_charset.

If convert is True, the string will be converted from the input
charset to the output charset automatically. This is not useful for
multibyte character sets, which have line length issues (multibyte
characters must be split on a character, not a byte boundary); use the
high-level Header class to deal with these issues. convert defaults
to False.

The type of encoding (base64 or quoted-printable) will be based on
self.header_encoding.
t
maxlinelenN(
RKRCR1R/RLRMt
header_encodeR@RQR0RRNRR(R5RBRCRTRURV((s%/usr/lib64/python2.6/email/charset.pyRYUs

cCsd|o|i|�}n|itjotii|�S|itjotii|�S|SdS(sÉBody-encode a string and convert it to output_charset.

If convert is True (the default), the string will be converted from
the input charset to output charset automatically. Unlike
header_encode(), there are no issues with byte boundaries and
multibyte charsets in email bodies, so this is usually pretty safe.

The type of encoding (base64 or quoted-printable) will be based on
self.body_encoding.
N(RCR2R/RLRMt body_encodeR@RQ(R5RBRC((s%/usr/lib64/python2.6/email/charset.pyRZts (t__name__t
__module__t__doc__tDEFAULT_CHARSETR9R:t__repr__R=R>RARCRFtTrueRJRKRWtFalseRYRZ(((s%/usr/lib64/python2.6/email/charset.pyR�s+ !          (NNN((t__all__temail.base64mimeRLtemail.quoprimimeRtemail.encodersRR@R/RRPR^R0RR"R%RRRR(((s%/usr/lib64/python2.6/email/charset.pyt<module>s�