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
4089eec0
Kaydet (Commit)
4089eec0
authored
Kas 29, 2012
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.3 (#16573)
üst
1d1210ec
daf28293
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
fixer_util.py
Lib/lib2to3/fixer_util.py
+6
-6
test_fixers.py
Lib/lib2to3/tests/test_fixers.py
+12
-0
NEWS
Misc/NEWS
+4
-0
No files found.
Lib/lib2to3/fixer_util.py
Dosyayı görüntüle @
4089eec0
...
...
@@ -165,7 +165,7 @@ def parenthesize(node):
consuming_calls
=
set
([
"sorted"
,
"list"
,
"set"
,
"any"
,
"all"
,
"tuple"
,
"sum"
,
"min"
,
"max"
])
"min"
,
"max"
,
"enumerate"
])
def
attr_chain
(
obj
,
attr
):
"""Follow an attribute chain.
...
...
@@ -192,14 +192,14 @@ p0 = """for_stmt< 'for' any 'in' node=any ':' any* >
p1
=
"""
power<
( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' | 'sum' |
'any' | 'all' | (any* trailer< '.' 'join' >) )
'any' | 'all' |
'enumerate' |
(any* trailer< '.' 'join' >) )
trailer< '(' node=any ')' >
any*
>
"""
p2
=
"""
power<
'sorted'
( 'sorted' | 'enumerate' )
trailer< '(' arglist<node=any any*> ')' >
any*
>
...
...
@@ -207,14 +207,14 @@ power<
pats_built
=
False
def
in_special_context
(
node
):
""" Returns true if node is in an environment where all that is required
of it is being it
t
erable (ie, it doesn't matter if it returns a list
or an it
t
erator).
of it is being iterable (ie, it doesn't matter if it returns a list
or an iterator).
See test_map_nochange in test_fixers.py for some examples and tests.
"""
global
p0
,
p1
,
p2
,
pats_built
if
not
pats_built
:
p1
=
patcomp
.
compile_pattern
(
p1
)
p0
=
patcomp
.
compile_pattern
(
p0
)
p1
=
patcomp
.
compile_pattern
(
p1
)
p2
=
patcomp
.
compile_pattern
(
p2
)
pats_built
=
True
patterns
=
[
p0
,
p1
,
p2
]
...
...
Lib/lib2to3/tests/test_fixers.py
Dosyayı görüntüle @
4089eec0
...
...
@@ -2981,6 +2981,10 @@ class Test_filter(FixerTestCase):
self
.
unchanged
(
a
)
a
=
"""sorted(filter(f, 'abc'), key=blah)[0]"""
self
.
unchanged
(
a
)
a
=
"""enumerate(filter(f, 'abc'))"""
self
.
unchanged
(
a
)
a
=
"""enumerate(filter(f, 'abc'), start=1)"""
self
.
unchanged
(
a
)
a
=
"""for i in filter(f, 'abc'): pass"""
self
.
unchanged
(
a
)
a
=
"""[x for x in filter(f, 'abc')]"""
...
...
@@ -3089,6 +3093,10 @@ class Test_map(FixerTestCase):
self
.
unchanged
(
a
)
a
=
"""sorted(map(f, 'abc'), key=blah)[0]"""
self
.
unchanged
(
a
)
a
=
"""enumerate(map(f, 'abc'))"""
self
.
unchanged
(
a
)
a
=
"""enumerate(map(f, 'abc'), start=1)"""
self
.
unchanged
(
a
)
a
=
"""for i in map(f, 'abc'): pass"""
self
.
unchanged
(
a
)
a
=
"""[x for x in map(f, 'abc')]"""
...
...
@@ -3152,6 +3160,10 @@ class Test_zip(FixerTestCase):
self
.
unchanged
(
a
)
a
=
"""sorted(zip(a, b), key=blah)[0]"""
self
.
unchanged
(
a
)
a
=
"""enumerate(zip(a, b))"""
self
.
unchanged
(
a
)
a
=
"""enumerate(zip(a, b), start=1)"""
self
.
unchanged
(
a
)
a
=
"""for i in zip(a, b): pass"""
self
.
unchanged
(
a
)
a
=
"""[x for x in zip(a, b)]"""
...
...
Misc/NEWS
Dosyayı görüntüle @
4089eec0
...
...
@@ -143,6 +143,10 @@ Library
- Issue #16333: use (",", ": ") as default separator when indent is specified
to avoid trailing whitespace. Patch by Serhiy Storchaka.
- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous
list() calls aren'
t
added
to
filter
(),
map
(),
and
zip
()
which
are
directly
passed
enumerate
().
-
Issue
#
16549
:
Make
json
.
tool
work
again
on
Python
3
and
add
tests
.
Initial
patch
by
Berker
Peksag
and
Serhiy
Storchaka
.
...
...
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