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
356afac4
Kaydet (Commit)
356afac4
authored
Eyl 10, 2002
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
_isstring(): Factor out "stringiness" test, e.g. for StringType or
UnicodeType, which is different between Python 2.1 and 2.2.
üst
45d9bde6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
_compat21.py
Lib/email/_compat21.py
+5
-1
_compat22.py
Lib/email/_compat22.py
+5
-1
No files found.
Lib/email/_compat21.py
Dosyayı görüntüle @
356afac4
...
@@ -30,6 +30,10 @@ def _floordiv(i, j):
...
@@ -30,6 +30,10 @@ def _floordiv(i, j):
return
i
/
j
return
i
/
j
def
_isstring
(
obj
):
return
isinstance
(
obj
,
StringType
)
or
isinstance
(
obj
,
UnicodeType
)
# These two functions are imported into the Iterators.py interface module.
# These two functions are imported into the Iterators.py interface module.
# The Python 2.2 version uses generators for efficiency.
# The Python 2.2 version uses generators for efficiency.
...
@@ -38,7 +42,7 @@ def body_line_iterator(msg):
...
@@ -38,7 +42,7 @@ def body_line_iterator(msg):
lines
=
[]
lines
=
[]
for
subpart
in
msg
.
walk
():
for
subpart
in
msg
.
walk
():
payload
=
subpart
.
get_payload
()
payload
=
subpart
.
get_payload
()
if
isinstance
(
payload
,
StringType
)
or
isinstance
(
payload
,
UnicodeType
):
if
_isstring
(
payload
):
for
line
in
StringIO
(
payload
)
.
readlines
():
for
line
in
StringIO
(
payload
)
.
readlines
():
lines
.
append
(
line
)
lines
.
append
(
line
)
return
lines
return
lines
...
...
Lib/email/_compat22.py
Dosyayı görüntüle @
356afac4
...
@@ -31,6 +31,10 @@ def _floordiv(i, j):
...
@@ -31,6 +31,10 @@ def _floordiv(i, j):
return
i
//
j
return
i
//
j
def
_isstring
(
obj
):
return
isinstance
(
obj
,
StringTypes
)
# These two functions are imported into the Iterators.py interface module.
# These two functions are imported into the Iterators.py interface module.
# The Python 2.2 version uses generators for efficiency.
# The Python 2.2 version uses generators for efficiency.
...
@@ -38,7 +42,7 @@ def body_line_iterator(msg):
...
@@ -38,7 +42,7 @@ def body_line_iterator(msg):
"""Iterate over the parts, returning string payloads line-by-line."""
"""Iterate over the parts, returning string payloads line-by-line."""
for
subpart
in
msg
.
walk
():
for
subpart
in
msg
.
walk
():
payload
=
subpart
.
get_payload
()
payload
=
subpart
.
get_payload
()
if
isinstance
(
payload
,
StringTypes
):
if
_isstring
(
payload
):
for
line
in
StringIO
(
payload
):
for
line
in
StringIO
(
payload
):
yield
line
yield
line
...
...
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