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
a6026c6a
Kaydet (Commit)
a6026c6a
authored
Eyl 22, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Back out multifile.py 1.19 and 1.20. Fixes #514676.
üst
4a385834
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
16 deletions
+67
-16
multifile.py
Lib/multifile.py
+1
-16
test_multifile.py
Lib/test/test_multifile.py
+66
-0
No files found.
Lib/multifile.py
Dosyayı görüntüle @
a6026c6a
...
...
@@ -41,7 +41,6 @@ class MultiFile:
self
.
stack
=
[]
# Grows down
self
.
level
=
0
self
.
last
=
0
self
.
readahead
=
""
if
seekable
:
self
.
seekable
=
1
self
.
start
=
self
.
fp
.
tell
()
...
...
@@ -50,7 +49,7 @@ class MultiFile:
def
tell
(
self
):
if
self
.
level
>
0
:
return
self
.
lastpos
return
self
.
fp
.
tell
()
-
len
(
self
.
readahead
)
-
self
.
start
return
self
.
fp
.
tell
()
-
self
.
start
def
seek
(
self
,
pos
,
whence
=
0
):
here
=
self
.
tell
()
...
...
@@ -68,22 +67,8 @@ class MultiFile:
self
.
fp
.
seek
(
pos
+
self
.
start
)
self
.
level
=
0
self
.
last
=
0
self
.
readahead
=
""
def
readline
(
self
):
if
not
self
.
readahead
:
self
.
readahead
=
self
.
_readline
()
line
=
self
.
readahead
if
line
:
self
.
readahead
=
self
.
_readline
()
if
not
self
.
readahead
:
if
line
[
-
2
:]
==
"
\r\n
"
:
line
=
line
[:
-
2
]
elif
line
[
-
1
:]
==
"
\n
"
:
line
=
line
[:
-
1
]
return
line
def
_readline
(
self
):
if
self
.
level
>
0
:
return
''
line
=
self
.
fp
.
readline
()
...
...
Lib/test/test_multifile.py
0 → 100644
Dosyayı görüntüle @
a6026c6a
import
mimetools
import
multifile
import
cStringIO
msg
=
"""Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="=====================_590453667==_"
X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]
--=====================_590453667==_
Content-Type: multipart/alternative;
boundary="=====================_590453677==_.ALT"
--=====================_590453677==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
test A
--=====================_590453677==_.ALT
Content-Type: text/html; charset="us-ascii"
<html>
<b>test B</font></b></html>
--=====================_590453677==_.ALT--
--=====================_590453667==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="att.txt"
Attached Content.
Attached Content.
Attached Content.
Attached Content.
--=====================_590453667==_--
"""
boundaries
=
0
linecount
=
0
def
getMIMEMsg
(
mf
):
global
boundaries
,
linecount
msg
=
mimetools
.
Message
(
mf
)
#print "TYPE: %s" % msg.gettype()
if
msg
.
getmaintype
()
==
'multipart'
:
boundary
=
msg
.
getparam
(
"boundary"
)
boundaries
+=
1
mf
.
push
(
boundary
)
while
mf
.
next
():
getMIMEMsg
(
mf
)
mf
.
pop
()
else
:
lines
=
mf
.
readlines
()
linecount
+=
len
(
lines
)
def
main
():
f
=
cStringIO
.
StringIO
(
msg
)
getMIMEMsg
(
multifile
.
MultiFile
(
f
))
assert
boundaries
==
2
assert
linecount
==
9
if
__name__
==
'__main__'
:
main
()
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