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
cc0def18
Kaydet (Commit)
cc0def18
authored
Agu 13, 2004
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert weak iterators to generator form.
üst
bf9ac4bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
51 deletions
+23
-51
weakref.py
Lib/weakref.py
+23
-51
No files found.
Lib/weakref.py
Dosyayı görüntüle @
cc0def18
...
@@ -277,54 +277,26 @@ class WeakKeyDictionary(UserDict.UserDict):
...
@@ -277,54 +277,26 @@ class WeakKeyDictionary(UserDict.UserDict):
self
.
update
(
kwargs
)
self
.
update
(
kwargs
)
class
BaseIter
:
def
WeakKeyedKeyIterator
(
weakdict
):
def
__iter__
(
self
):
for
wr
in
weakdict
.
data
.
iterkeys
():
return
self
obj
=
wr
()
if
obj
is
not
None
:
yield
obj
class
WeakKeyedKeyIterator
(
BaseIter
):
def
__init__
(
self
,
weakdict
):
def
WeakKeyedItemIterator
(
weakdict
):
self
.
_next
=
weakdict
.
data
.
iterkeys
()
.
next
for
wr
,
value
in
weakdict
.
data
.
iteritems
():
key
=
wr
()
def
next
(
self
):
if
key
is
not
None
:
while
1
:
yield
key
,
value
wr
=
self
.
_next
()
obj
=
wr
()
def
WeakValuedValueIterator
(
weakdict
):
if
obj
is
not
None
:
for
wr
in
weakdict
.
data
.
itervalues
():
return
obj
obj
=
wr
()
if
obj
is
not
None
:
yield
obj
class
WeakKeyedItemIterator
(
BaseIter
):
def
__init__
(
self
,
weakdict
):
def
WeakValuedItemIterator
(
weakdict
):
self
.
_next
=
weakdict
.
data
.
iteritems
()
.
next
for
wr
in
weakdict
.
data
.
itervalues
():
value
=
wr
()
def
next
(
self
):
if
value
is
not
None
:
while
1
:
yield
wr
.
key
,
value
wr
,
value
=
self
.
_next
()
key
=
wr
()
if
key
is
not
None
:
return
key
,
value
class
WeakValuedValueIterator
(
BaseIter
):
def
__init__
(
self
,
weakdict
):
self
.
_next
=
weakdict
.
data
.
itervalues
()
.
next
def
next
(
self
):
while
1
:
wr
=
self
.
_next
()
obj
=
wr
()
if
obj
is
not
None
:
return
obj
class
WeakValuedItemIterator
(
BaseIter
):
def
__init__
(
self
,
weakdict
):
self
.
_next
=
weakdict
.
data
.
itervalues
()
.
next
def
next
(
self
):
while
1
:
wr
=
self
.
_next
()
value
=
wr
()
if
value
is
not
None
:
return
wr
.
key
,
value
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