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
9ab96946
Kaydet (Commit)
9ab96946
authored
Eyl 12, 2015
tarafından
Martin Panter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #16473: Merge codecs doc and test from 3.4 into 3.5
üst
3133a9f5
06171bd5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
codecs.rst
Doc/library/codecs.rst
+8
-8
quopri_codec.py
Lib/encodings/quopri_codec.py
+1
-1
test_codecs.py
Lib/test/test_codecs.py
+8
-0
No files found.
Doc/library/codecs.rst
Dosyayı görüntüle @
9ab96946
...
@@ -1310,9 +1310,9 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
...
@@ -1310,9 +1310,9 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
| Codec | Aliases | Purpose | Encoder / decoder |
| Codec | Aliases | Purpose | Encoder / decoder |
+======================+==================+==============================+==============================+
+======================+==================+==============================+==============================+
| base64_codec [#b64]_ | base64, base_64 | Convert operand to
MIME | :meth:`base64.b64encode` /
|
| base64_codec [#b64]_ | base64, base_64 | Convert operand to
multiline | :meth:`base64.encodebytes` /
|
| | |
base64 (the result always | :meth:`base64.b64decode`
|
| | |
MIME base64 (the result | :meth:`base64.decodebytes`
|
| | |
includes a trailing
| |
| | |
always includes a trailing
| |
| | | ``'\n'``) | |
| | | ``'\n'``) | |
| | | | |
| | | | |
| | | .. versionchanged:: 3.4 | |
| | | .. versionchanged:: 3.4 | |
...
@@ -1324,14 +1324,14 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
...
@@ -1324,14 +1324,14 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
| bz2_codec | bz2 | Compress the operand | :meth:`bz2.compress` / |
| bz2_codec | bz2 | Compress the operand | :meth:`bz2.compress` / |
| | | using bz2 | :meth:`bz2.decompress` |
| | | using bz2 | :meth:`bz2.decompress` |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
| hex_codec | hex | Convert operand to | :meth:`b
ase64.b16encode
` / |
| hex_codec | hex | Convert operand to | :meth:`b
inascii.b2a_hex
` / |
| | | hexadecimal | :meth:`b
ase64.b16decode
` |
| | | hexadecimal | :meth:`b
inascii.a2b_hex
` |
| | | representation, with two | |
| | | representation, with two | |
| | | digits per byte | |
| | | digits per byte | |
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
| quopri_codec | quopri, | Convert operand to MIME | :meth:`quopri.encode
string` /
|
| quopri_codec | quopri, | Convert operand to MIME | :meth:`quopri.encode
` with
|
| | quotedprintable, | quoted printable |
:meth:`quopri.decodestring`
|
| | quotedprintable, | quoted printable |
``quotetabs=True`` /
|
| | quoted_printable | |
|
| | quoted_printable | |
:meth:`quopri.decode`
|
+----------------------+------------------+------------------------------+------------------------------+
+----------------------+------------------+------------------------------+------------------------------+
| uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
| uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
| | | uuencode | :meth:`uu.decode` |
| | | uuencode | :meth:`uu.decode` |
...
...
Lib/encodings/quopri_codec.py
Dosyayı görüntüle @
9ab96946
...
@@ -11,7 +11,7 @@ def quopri_encode(input, errors='strict'):
...
@@ -11,7 +11,7 @@ def quopri_encode(input, errors='strict'):
assert
errors
==
'strict'
assert
errors
==
'strict'
f
=
BytesIO
(
input
)
f
=
BytesIO
(
input
)
g
=
BytesIO
()
g
=
BytesIO
()
quopri
.
encode
(
f
,
g
,
1
)
quopri
.
encode
(
f
,
g
,
quotetabs
=
True
)
return
(
g
.
getvalue
(),
len
(
input
))
return
(
g
.
getvalue
(),
len
(
input
))
def
quopri_decode
(
input
,
errors
=
'strict'
):
def
quopri_decode
(
input
,
errors
=
'strict'
):
...
...
Lib/test/test_codecs.py
Dosyayı görüntüle @
9ab96946
...
@@ -2684,6 +2684,14 @@ class TransformCodecTest(unittest.TestCase):
...
@@ -2684,6 +2684,14 @@ class TransformCodecTest(unittest.TestCase):
info
=
codecs
.
lookup
(
alias
)
info
=
codecs
.
lookup
(
alias
)
self
.
assertEqual
(
info
.
name
,
expected_name
)
self
.
assertEqual
(
info
.
name
,
expected_name
)
def
test_quopri_stateless
(
self
):
# Should encode with quotetabs=True
encoded
=
codecs
.
encode
(
b
"space tab
\t
eol
\n
"
,
"quopri-codec"
)
self
.
assertEqual
(
encoded
,
b
"space=20tab=09eol=20
\n
"
)
# But should still support unescaped tabs and spaces
unescaped
=
b
"space tab eol
\n
"
self
.
assertEqual
(
codecs
.
decode
(
unescaped
,
"quopri-codec"
),
unescaped
)
def
test_uu_invalid
(
self
):
def
test_uu_invalid
(
self
):
# Missing "begin" line
# Missing "begin" line
self
.
assertRaises
(
ValueError
,
codecs
.
decode
,
b
""
,
"uu-codec"
)
self
.
assertRaises
(
ValueError
,
codecs
.
decode
,
b
""
,
"uu-codec"
)
...
...
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