[Zodb-checkins] CVS: Zope/lib/python/BTrees - check.py:1.1.4.3
Tim Peters
tim.one@comcast.net
Wed, 15 Jan 2003 13:06:02 -0500
Update of /cvs-repository/Zope/lib/python/BTrees
In directory cvs.zope.org:/tmp/cvs-serv11741
Modified Files:
Tag: Zope-2_6-branch
check.py
Log Message:
Backporting 2.1 compatibility fixes from Fred.
=== Zope/lib/python/BTrees/check.py 1.1.4.2 => 1.1.4.3 ===
--- Zope/lib/python/BTrees/check.py:1.1.4.2 Tue Jan 14 17:33:04 2003
+++ Zope/lib/python/BTrees/check.py Wed Jan 15 13:05:59 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