[Zodb-checkins] CVS: ZODB3/BTrees - check.py:1.3

Fred L. Drake, Jr. fred@zope.com
Wed, 15 Jan 2003 12:57:51 -0500


Update of /cvs-repository/ZODB3/BTrees
In directory cvs.zope.org:/tmp/cvs-serv10622

Modified Files:
	check.py 
Log Message:
Make this compatible with Python 2.1.


=== ZODB3/BTrees/check.py 1.2 => 1.3 ===
--- ZODB3/BTrees/check.py:1.2	Tue Jan 14 17:32:38 2003
+++ ZODB3/BTrees/check.py	Wed Jan 15 12:57:49 2003
@@ -32,6 +32,8 @@
 that doesn't exist in the actual BTree).
 """
 
+from types import TupleType
+
 try:
     from zodb.btrees.OOBTree import OOBTree, OOBucket, OOSet, OOTreeSet
     from zodb.btrees.OIBTree import OIBTree, OIBucket, OISet, OITreeSet
@@ -45,6 +47,12 @@
 
 TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3)
 
+try:
+    True
+except NameError:
+    True = 1
+    False = 0
+
 _type2kind = {IOBTree: (TYPE_BTREE, True),
               IIBTree: (TYPE_BTREE, True),
               OIBTree: (TYPE_BTREE, True),
@@ -131,10 +139,10 @@
     if state is None:
         return BTREE_EMPTY, [], []
 
-    assert isinstance(state, tuple)
+    assert isinstance(state, TupleType)
     if len(state) == 1:
         state = state[0]
-        assert isinstance(state, tuple) and len(state) == 1
+        assert isinstance(state, TupleType) and len(state) == 1
         state = state[0]
         return BTREE_ONE, state, None
 
@@ -183,7 +191,7 @@
 
 def crack_bucket(b, is_mapping):
     state = b.__getstate__()
-    assert isinstance(state, tuple)
+    assert isinstance(state, TupleType)
     assert 1 <= len(state) <= 2
     data = state[0]
     if not is_mapping:
@@ -210,7 +218,7 @@
 # visit_XYZ() methods once for each node in the tree, in depth-first
 # left-to-right order.
 
-class Walker(object):
+class Walker:
     def __init__(self, obj):
         self.obj = obj