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
f070f1cb
Kaydet (Commit)
f070f1cb
authored
May 23, 2015
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #21448: Improve performance of the email feedparser
üst
573b44c1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
feedparser.py
Lib/email/feedparser.py
+8
-8
No files found.
Lib/email/feedparser.py
Dosyayı görüntüle @
f070f1cb
...
...
@@ -26,6 +26,7 @@ import re
from
email
import
errors
from
email
import
message
from
email._policybase
import
compat32
from
collections
import
deque
NLCRE
=
re
.
compile
(
'
\r\n
|
\r
|
\n
'
)
NLCRE_bol
=
re
.
compile
(
'(
\r\n
|
\r
|
\n
)'
)
...
...
@@ -52,8 +53,8 @@ class BufferedSubFile(object):
def
__init__
(
self
):
# Chunks of the last partial line pushed into this object.
self
.
_partial
=
[]
#
The list of full, pushed lines, in reverse order
self
.
_lines
=
[]
#
A deque of full, pushed lines
self
.
_lines
=
deque
()
# The stack of false-EOF checking predicates.
self
.
_eofstack
=
[]
# A flag indicating whether the file has been closed or not.
...
...
@@ -78,21 +79,21 @@ class BufferedSubFile(object):
return
NeedMoreData
# Pop the line off the stack and see if it matches the current
# false-EOF predicate.
line
=
self
.
_lines
.
pop
()
line
=
self
.
_lines
.
pop
left
()
# RFC 2046, section 5.1.2 requires us to recognize outer level
# boundaries at any level of inner nesting. Do this, but be sure it's
# in the order of most to least nested.
for
ateof
in
self
.
_eofstack
[::
-
1
]
:
for
ateof
in
reversed
(
self
.
_eofstack
)
:
if
ateof
(
line
):
# We're at the false EOF. But push the last line back first.
self
.
_lines
.
append
(
line
)
self
.
_lines
.
append
left
(
line
)
return
''
return
line
def
unreadline
(
self
,
line
):
# Let the consumer push a line back into the buffer.
assert
line
is
not
NeedMoreData
self
.
_lines
.
append
(
line
)
self
.
_lines
.
append
left
(
line
)
def
push
(
self
,
data
):
"""Push some new data into this object."""
...
...
@@ -119,8 +120,7 @@ class BufferedSubFile(object):
self
.
pushlines
(
parts
)
def
pushlines
(
self
,
lines
):
# Reverse and insert at the front of the lines.
self
.
_lines
[:
0
]
=
lines
[::
-
1
]
self
.
_lines
.
extend
(
lines
)
def
__iter__
(
self
):
return
self
...
...
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