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
4603487d
Kaydet (Commit)
4603487d
authored
Tem 07, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#18020: improve html.escape speed by an order of magnitude. Patch by Matt Bryant.
üst
071029fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
__init__.py
Lib/html/__init__.py
+6
-7
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/html/__init__.py
Dosyayı görüntüle @
4603487d
...
@@ -2,11 +2,6 @@
...
@@ -2,11 +2,6 @@
General functions for HTML manipulation.
General functions for HTML manipulation.
"""
"""
_escape_map
=
{
ord
(
'&'
):
'&'
,
ord
(
'<'
):
'<'
,
ord
(
'>'
):
'>'
}
_escape_map_full
=
{
ord
(
'&'
):
'&'
,
ord
(
'<'
):
'<'
,
ord
(
'>'
):
'>'
,
ord
(
'"'
):
'"'
,
ord
(
'
\'
'
):
'''
}
# NB: this is a candidate for a bytes/string polymorphic interface
# NB: this is a candidate for a bytes/string polymorphic interface
def
escape
(
s
,
quote
=
True
):
def
escape
(
s
,
quote
=
True
):
...
@@ -16,6 +11,10 @@ def escape(s, quote=True):
...
@@ -16,6 +11,10 @@ def escape(s, quote=True):
characters, both double quote (") and single quote (') characters are also
characters, both double quote (") and single quote (') characters are also
translated.
translated.
"""
"""
s
=
s
.
replace
(
"&"
,
"&"
)
# Must be done first!
s
=
s
.
replace
(
"<"
,
"<"
)
s
=
s
.
replace
(
">"
,
">"
)
if
quote
:
if
quote
:
return
s
.
translate
(
_escape_map_full
)
s
=
s
.
replace
(
'"'
,
"""
)
return
s
.
translate
(
_escape_map
)
s
=
s
.
replace
(
'
\'
'
,
"'"
)
return
s
Misc/ACKS
Dosyayı görüntüle @
4603487d
...
@@ -172,6 +172,7 @@ Dave Brueck
...
@@ -172,6 +172,7 @@ Dave Brueck
Francisco Martín Brugué
Francisco Martín Brugué
Ian Bruntlett
Ian Bruntlett
Floris Bruynooghe
Floris Bruynooghe
Matt Bryant
Stan Bubrouski
Stan Bubrouski
Erik de Bueger
Erik de Bueger
Jan-Hein Bührman
Jan-Hein Bührman
...
...
Misc/NEWS
Dosyayı görüntüle @
4603487d
...
@@ -142,6 +142,9 @@ Core and Builtins
...
@@ -142,6 +142,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
18020
:
improve
html
.
escape
speed
by
an
order
of
magnitude
.
Patch
by
Matt
Bryant
.
-
Issue
#
18347
:
ElementTree
's html serializer now preserves the case of
-
Issue
#
18347
:
ElementTree
's html serializer now preserves the case of
closing tags.
closing tags.
...
...
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