Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3d1f397f
Kaydet (Commit)
3d1f397f
authored
May 09, 2004
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a
bunch of module globals that aren't used.
üst
36112f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
27 deletions
+6
-27
Header.py
Lib/email/Header.py
+6
-27
No files found.
Lib/email/Header.py
Dosyayı görüntüle @
3d1f397f
# Copyright (C) 2002 Python Software Foundation
# Author: che@debian.org (Ben Gertzfield), barry@
zope.com
(Barry Warsaw)
# Copyright (C) 2002
-2004
Python Software Foundation
# Author: che@debian.org (Ben Gertzfield), barry@
python.org
(Barry Warsaw)
"""Header encoding and decoding functionality."""
import
re
import
binascii
from
types
import
StringType
,
UnicodeType
import
email.quopriMIME
import
email.base64MIME
from
email.Errors
import
HeaderParseError
from
email.Charset
import
Charset
try
:
from
email._compat22
import
_floordiv
except
SyntaxError
:
# Python 2.1 spells integer division differently
from
email._compat21
import
_floordiv
try
:
True
,
False
except
NameError
:
True
=
1
False
=
0
CRLFSPACE
=
'
\r\n
'
CRLF
=
'
\r\n
'
NL
=
'
\n
'
SPACE
=
' '
USPACE
=
u' '
SPACE8
=
' '
*
8
EMPTYSTRING
=
''
UEMPTYSTRING
=
u''
MAXLINELEN
=
76
ENCODE
=
1
DECODE
=
2
USASCII
=
Charset
(
'us-ascii'
)
UTF8
=
Charset
(
'utf-8'
)
...
...
@@ -52,8 +33,6 @@ ecre = re.compile(r'''
\?= # literal ?=
'''
,
re
.
VERBOSE
|
re
.
IGNORECASE
)
pcre
=
re
.
compile
(
'([,;])'
)
# Field name regexp, including trailing colon, but not separating whitespace,
# according to RFC 2822. Character range is from tilde to exclamation mark.
# For use with .match()
...
...
@@ -244,8 +223,8 @@ class Header:
constructor is used.
s may be a byte string or a Unicode string. If it is a byte string
(i.e. isinstance(s,
StringType) is true), then charset is the encoding
of
that byte string, and a UnicodeError will be raised if the string
(i.e. isinstance(s,
str) is true), then charset is the encoding of
that byte string, and a UnicodeError will be raised if the string
cannot be decoded with that charset. If s is a Unicode string, then
charset is a hint specifying the character set of the characters in
the string. In this case, when producing an RFC 2822 compliant header
...
...
@@ -265,7 +244,7 @@ class Header:
# We need to test that the string can be converted to unicode and
# back to a byte string, given the input and output codecs of the
# charset.
if
isinstance
(
s
,
StringType
):
if
isinstance
(
s
,
str
):
# Possibly raise UnicodeError if the byte string can't be
# converted to a unicode with the input codec of the charset.
incodec
=
charset
.
input_codec
or
'us-ascii'
...
...
@@ -275,7 +254,7 @@ class Header:
# than the iput coded. Still, use the original byte string.
outcodec
=
charset
.
output_codec
or
'us-ascii'
ustr
.
encode
(
outcodec
,
errors
)
elif
isinstance
(
s
,
UnicodeTyp
e
):
elif
isinstance
(
s
,
unicod
e
):
# Now we have to be sure the unicode string can be converted
# to a byte string with a reasonable output codec. We want to
# use the byte string in the chunk.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment