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
cec1b3f6
Kaydet (Commit)
cec1b3f6
authored
Eyl 20, 2003
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Maintain backwards compatibility with python < 2.3 by dynamically
adding the iterator interface for python >= 2.3.
üst
0aab0020
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
__init__.py
Lib/bsddb/__init__.py
+30
-18
No files found.
Lib/bsddb/__init__.py
Dosyayı görüntüle @
cec1b3f6
...
...
@@ -52,9 +52,38 @@ error = db.DBError # So bsddb.error will mean something...
#----------------------------------------------------------------------
import
sys
# for backwards compatibility with python versions older than 2.3, the
# iterator interface is dynamically defined and added using a mixin
# class. old python can't tokenize it due to the yield keyword.
if
sys
.
version
>=
'2.3'
:
exec
"""
import UserDict
class _iter_mixin(UserDict.DictMixin):
def __iter__(self):
try:
yield self.first()[0]
next = self.next
while 1:
yield next()[0]
except _bsddb.DBNotFoundError:
return
def iteritems(self):
try:
yield self.first()
next = self.next
while 1:
yield next()
except _bsddb.DBNotFoundError:
return
"""
else
:
class
_iter_mixin
:
pass
class
_DBWithCursor
(
UserDict
.
DictMixin
):
class
_DBWithCursor
(
_iter_mixin
):
"""
A simple wrapper around DB that makes it look like the bsddbobject in
the old module. It uses a cursor as needed to provide DB traversal.
...
...
@@ -145,23 +174,6 @@ class _DBWithCursor(UserDict.DictMixin):
self
.
_checkOpen
()
return
self
.
db
.
sync
()
def
__iter__
(
self
):
try
:
yield
self
.
first
()[
0
]
next
=
self
.
next
while
1
:
yield
next
()[
0
]
except
_bsddb
.
DBNotFoundError
:
return
def
iteritems
(
self
):
try
:
yield
self
.
first
()
next
=
self
.
next
while
1
:
yield
next
()
except
_bsddb
.
DBNotFoundError
:
return
#----------------------------------------------------------------------
# Compatibility object factory functions
...
...
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