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
b90f417d
Kaydet (Commit)
b90f417d
authored
Agu 04, 2013
tarafından
Larry Hastings
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merging the 3.4.0a1 head.
üst
a3c6a1fb
c4216ab9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
8 deletions
+23
-8
xml.etree.elementtree.rst
Doc/library/xml.etree.elementtree.rst
+3
-2
sre_compile.py
Lib/sre_compile.py
+2
-2
test_unicode.py
Lib/test/test_unicode.py
+0
-2
test_xml_etree.py
Lib/test/test_xml_etree.py
+14
-0
ElementPath.py
Lib/xml/etree/ElementPath.py
+4
-2
No files found.
Doc/library/xml.etree.elementtree.rst
Dosyayı görüntüle @
b90f417d
...
...
@@ -416,7 +416,8 @@ Functions
and ``"end-ns"`` (the "ns" events are used to get detailed namespace
information). If *events* is omitted, only ``"end"`` events are reported.
*parser* is an optional parser instance. If not given, the standard
:class:`XMLParser` parser is used. Returns an :term:`iterator` providing
:class:`XMLParser` parser is used. *parser* can only use the default
:class:`TreeBuilder` as a target. Returns an :term:`iterator` providing
``(event, elem)`` pairs.
Note that while :func:`iterparse` builds the tree incrementally, it issues
...
...
@@ -880,7 +881,7 @@ IncrementalParser Objects
events are used to get detailed namespace information). If *events* is
omitted, only ``"end"`` events are reported. *parser* is an optional
parser instance. If not given, the standard :class:`XMLParser` parser is
used.
used.
*parser* can only use the default :class:`TreeBuilder` as a target.
.. method:: data_received(data)
...
...
Lib/sre_compile.py
Dosyayı görüntüle @
b90f417d
...
...
@@ -351,8 +351,8 @@ def _optimize_unicode(charset, fixup):
def
_simple
(
av
):
# check if av is a "simple" operator
lo
,
hi
=
av
[
2
]
.
getwidth
()
if
lo
==
0
and
hi
==
MAXREPEAT
:
raise
error
(
"nothing to repeat"
)
#
if lo == 0 and hi == MAXREPEAT:
#
raise error("nothing to repeat")
return
lo
==
hi
==
1
and
av
[
2
][
0
][
0
]
!=
SUBPATTERN
def
_compile_info
(
code
,
pattern
,
flags
):
...
...
Lib/test/test_unicode.py
Dosyayı görüntüle @
b90f417d
...
...
@@ -1735,8 +1735,6 @@ class UnicodeTest(string_tests.CommonTest,
self
.
assertRaises
(
TypeError
,
"hello"
.
encode
,
42
,
42
,
42
)
# Error handling (lone surrogate in PyUnicode_TransformDecimalToASCII())
self
.
assertRaises
(
UnicodeError
,
int
,
"
\ud800
"
)
self
.
assertRaises
(
UnicodeError
,
int
,
"
\udf00
"
)
self
.
assertRaises
(
UnicodeError
,
float
,
"
\ud800
"
)
self
.
assertRaises
(
UnicodeError
,
float
,
"
\udf00
"
)
self
.
assertRaises
(
UnicodeError
,
complex
,
"
\ud800
"
)
...
...
Lib/test/test_xml_etree.py
Dosyayı görüntüle @
b90f417d
...
...
@@ -1839,6 +1839,20 @@ class ElementFindTest(unittest.TestCase):
summarize_list
(
e
.
findall
(
".//{http://effbot.org/ns}tag"
)),
[
'{http://effbot.org/ns}tag'
]
*
3
)
def
test_findall_different_nsmaps
(
self
):
root
=
ET
.
XML
(
'''
<a xmlns:x="X" xmlns:y="Y">
<x:b><c/></x:b>
<b/>
<c><x:b/><b/></c><y:b/>
</a>'''
)
nsmap
=
{
'xx'
:
'X'
}
self
.
assertEqual
(
len
(
root
.
findall
(
".//xx:b"
,
namespaces
=
nsmap
)),
2
)
self
.
assertEqual
(
len
(
root
.
findall
(
".//b"
,
namespaces
=
nsmap
)),
2
)
nsmap
=
{
'xx'
:
'Y'
}
self
.
assertEqual
(
len
(
root
.
findall
(
".//xx:b"
,
namespaces
=
nsmap
)),
1
)
self
.
assertEqual
(
len
(
root
.
findall
(
".//b"
,
namespaces
=
nsmap
)),
2
)
def
test_bad_find
(
self
):
e
=
ET
.
XML
(
SAMPLE_XML
)
with
self
.
assertRaisesRegex
(
SyntaxError
,
'cannot use absolute path'
):
...
...
Lib/xml/etree/ElementPath.py
Dosyayı görüntüle @
b90f417d
...
...
@@ -249,10 +249,12 @@ class _SelectorContext:
def
iterfind
(
elem
,
path
,
namespaces
=
None
):
# compile selector pattern
cache_key
=
(
path
,
None
if
namespaces
is
None
else
tuple
(
sorted
(
namespaces
.
items
())))
if
path
[
-
1
:]
==
"/"
:
path
=
path
+
"*"
# implicit all (FIXME: keep this?)
try
:
selector
=
_cache
[
path
]
selector
=
_cache
[
cache_key
]
except
KeyError
:
if
len
(
_cache
)
>
100
:
_cache
.
clear
()
...
...
@@ -272,7 +274,7 @@ def iterfind(elem, path, namespaces=None):
token
=
next
()
except
StopIteration
:
break
_cache
[
path
]
=
selector
_cache
[
cache_key
]
=
selector
# execute selector pattern
result
=
[
elem
]
context
=
_SelectorContext
(
elem
)
...
...
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