Commit 5432039c authored by Fred Drake's avatar Fred Drake

re-jigger the family interface:

- use shorter names for the modules, since they are being used in a
  qualified context
- add "OO" to both families so that a family is sufficient to get to all
  types of tree
parent 168f452c
......@@ -440,16 +440,13 @@ class IMergeIntegerKey(IMerge):
linear-time pass.
"""
class IIntegerFamily(Interface):
class IBTreeFamily(Interface):
"""the 64-bit or 32-bit family"""
IOModule = Attribute(
'The IIntegerObjectBTreeModule for this family')
OIModule = Attribute(
'The IObjectIntegerBTreeModule for this family')
IIModule = Attribute(
'The IIntegerIntegerBTreeModule for this family')
IFModule = Attribute(
'The IIntegerFloatBTreeModule for this family')
IO = Attribute('The IIntegerObjectBTreeModule for this family')
OI = Attribute('The IObjectIntegerBTreeModule for this family')
II = Attribute('The IIntegerIntegerBTreeModule for this family')
IF = Attribute('The IIntegerFloatBTreeModule for this family')
OO = Attribute('The IObjectObjectBTreeModule for this family')
maxint = Attribute('The maximum integer storable in this family')
minint = Attribute('The minimum integer storable in this family')
......@@ -459,7 +456,7 @@ class IIntegerObjectBTreeModule(IBTreeModule, IMerge):
describes IOBTree and LOBTree"""
family = Attribute('The IIntegerFamily of this module')
family = Attribute('The IBTreeFamily of this module')
class IObjectIntegerBTreeModule(IBTreeModule, IIMerge):
......@@ -470,7 +467,7 @@ class IObjectIntegerBTreeModule(IBTreeModule, IIMerge):
describes OIBTree and LOBTree"""
family = Attribute('The IIntegerFamily of this module')
family = Attribute('The IBTreeFamily of this module')
class IIntegerIntegerBTreeModule(IBTreeModule, IIMerge, IMergeIntegerKey):
......@@ -478,7 +475,7 @@ class IIntegerIntegerBTreeModule(IBTreeModule, IIMerge, IMergeIntegerKey):
describes IIBTree and LLBTree"""
family = Attribute('The IIntegerFamily of this module')
family = Attribute('The IBTreeFamily of this module')
class IObjectObjectBTreeModule(IBTreeModule, IMerge):
......@@ -489,13 +486,16 @@ class IObjectObjectBTreeModule(IBTreeModule, IMerge):
describes OOBTree"""
# Note that there's no ``family`` attribute; all families include
# the OO flavor of BTrees.
class IIntegerFloatBTreeModule(IBTreeModule, IMerge):
"""keys, or set values, are integers; values are floats.
describes IFBTree and LFBTree"""
family = Attribute('The IIntegerFamily of this module')
family = Attribute('The IBTreeFamily of this module')
###############################################################
......
import BTrees.family64
import BTrees.family32
BTrees.family64.IOModule.family = BTrees.family64
BTrees.family64.OIModule.family = BTrees.family64
BTrees.family64.IFModule.family = BTrees.family64
BTrees.family64.IIModule.family = BTrees.family64
BTrees.family64.IO.family = BTrees.family64
BTrees.family64.OI.family = BTrees.family64
BTrees.family64.IF.family = BTrees.family64
BTrees.family64.II.family = BTrees.family64
BTrees.family32.IOModule.family = BTrees.family32
BTrees.family32.OIModule.family = BTrees.family32
BTrees.family32.IFModule.family = BTrees.family32
BTrees.family32.IIModule.family = BTrees.family32
BTrees.family32.IO.family = BTrees.family32
BTrees.family32.OI.family = BTrees.family32
BTrees.family32.IF.family = BTrees.family32
BTrees.family32.II.family = BTrees.family32
import sys
#############################################################################
#
# Copyright (c) 2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
#############################################################################
import zope.interface
import BTrees.Interfaces
from BTrees import IOBTree as IOModule
from BTrees import OIBTree as OIModule
from BTrees import IFBTree as IFModule
from BTrees import IIBTree as IIModule
from BTrees import IOBTree as IO
from BTrees import OIBTree as OI
from BTrees import IFBTree as IF
from BTrees import IIBTree as II
from BTrees import OOBTree as OO
maxint = int(2**31-1)
minint = -maxint - 1
zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFamily)
zope.interface.moduleProvides(BTrees.Interfaces.IBTreeFamily)
import sys
#############################################################################
#
# Copyright (c) 2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
#############################################################################
import zope.interface
import BTrees.Interfaces
from BTrees import LOBTree as IOModule
from BTrees import OLBTree as OIModule
from BTrees import LFBTree as IFModule
from BTrees import LLBTree as IIModule
from BTrees import LOBTree as IO
from BTrees import OLBTree as OI
from BTrees import LFBTree as IF
from BTrees import LLBTree as II
from BTrees import OOBTree as OO
maxint = 2**63-1
minint = -maxint - 1
zope.interface.moduleProvides(BTrees.Interfaces.IIntegerFamily)
zope.interface.moduleProvides(BTrees.Interfaces.IBTreeFamily)
......@@ -26,18 +26,7 @@ from BTrees.LLBTree import LLBTree, LLBucket, LLSet, LLTreeSet
from BTrees.LFBTree import LFBTree, LFBucket, LFSet, LFTreeSet
from BTrees.OLBTree import OLBTree, OLBucket, OLSet, OLTreeSet
import BTrees.family32
import BTrees.family64
import BTrees.OOBTree
import BTrees.IOBTree
import BTrees.IIBTree
import BTrees.IFBTree
import BTrees.OIBTree
import BTrees.LOBTree
import BTrees.LLBTree
import BTrees.LFBTree
import BTrees.OLBTree
import BTrees.Interfaces
import BTrees
from BTrees.IIBTree import using64bits
from BTrees.check import check
......@@ -1691,15 +1680,17 @@ class FamilyTest(TestCase):
def test32(self):
self.assert_(
zope.interface.verify.verifyObject(
BTrees.Interfaces.IIntegerFamily, BTrees.family32))
BTrees.Interfaces.IBTreeFamily, BTrees.family32))
self.assertEquals(
BTrees.family32.IOModule, BTrees.IOBTree)
BTrees.family32.IO, BTrees.IOBTree)
self.assertEquals(
BTrees.family32.OIModule, BTrees.OIBTree)
BTrees.family32.OI, BTrees.OIBTree)
self.assertEquals(
BTrees.family32.IIModule, BTrees.IIBTree)
BTrees.family32.II, BTrees.IIBTree)
self.assertEquals(
BTrees.family32.IFModule, BTrees.IFBTree)
BTrees.family32.IF, BTrees.IFBTree)
self.assertEquals(
BTrees.family32.OO, BTrees.OOBTree)
s = IOTreeSet()
s.insert(BTrees.family32.maxint)
self.assert_(BTrees.family32.maxint in s)
......@@ -1725,15 +1716,17 @@ class FamilyTest(TestCase):
def test64(self):
self.assert_(
zope.interface.verify.verifyObject(
BTrees.Interfaces.IIntegerFamily, BTrees.family64))
BTrees.Interfaces.IBTreeFamily, BTrees.family64))
self.assertEquals(
BTrees.family64.IO, BTrees.LOBTree)
self.assertEquals(
BTrees.family64.IOModule, BTrees.LOBTree)
BTrees.family64.OI, BTrees.OLBTree)
self.assertEquals(
BTrees.family64.OIModule, BTrees.OLBTree)
BTrees.family64.II, BTrees.LLBTree)
self.assertEquals(
BTrees.family64.IIModule, BTrees.LLBTree)
BTrees.family64.IF, BTrees.LFBTree)
self.assertEquals(
BTrees.family64.IFModule, BTrees.LFBTree)
BTrees.family64.OO, BTrees.OOBTree)
s = LOTreeSet()
s.insert(BTrees.family64.maxint)
self.assert_(BTrees.family64.maxint in s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment