[Zope-Checkins] CVS: Zope3/lib/python/Persistence/BTrees - Interfaces.py:1.5

Tim Peters tim.one@comcast.net
Tue, 25 Jun 2002 14:57:08 -0400


Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv23753

Modified Files:
	Interfaces.py 
Log Message:
Added the first, trivial tests of weightedUnion and weightedIntersection,
and started repairing obvious errors in their docs.  More to come.


=== Zope3/lib/python/Persistence/BTrees/Interfaces.py 1.4 => 1.5 ===
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (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 OOBTree, Interface, Interface.Standard
 
@@ -69,7 +69,7 @@
         """
 
 class ISetMutable(IKeyed):
-    
+
     def insert(key):
         """Add the key (value) to the set.
 
@@ -78,7 +78,7 @@
 
     def remove(key):
         """Remove the key from the set."""
-        
+
     def update(seq):
         """Add the items from the given sequence to the set"""
 
@@ -96,7 +96,7 @@
 
 class ITreeSet(IKeyed, ISetMutable):
     pass
-    
+
 
 class IDictionaryIsh(IKeyed, Interface.Standard.MinimalDictionary):
 
@@ -147,7 +147,7 @@
         the minimum value. This normalization may be a noop, but, for
         integer values, the normalization is division.
         """
-    
+
 class IBTree(IDictionaryIsh):
 
     def insert(key, value):
@@ -230,13 +230,11 @@
     def weightedUnion(c1, c2, weight1=1, weight2=1):
         """Compute the weighted Union of c1 and c2.
 
-        If c1 and c2 are None, the output is 0 and None
+        If c1 and c2 are None, the output is (0, None).
 
-        if c1 is None and c2 is not None, the output is weight2 and
-        c2.
+        If c1 is None and c2 is not None, the output is (weight2, c2).
 
-        if c1 is not None and c2 not None, the output is weight1 and
-        c1.
+        If c1 is not None and c2 is None, the output is (weight1, c1).
 
         If c1 and c2 are not None, the output is 1 and a Bucket
         such that the output values are::
@@ -258,13 +256,11 @@
     def weightedIntersection(c1, c2, weight1=1, weight2=1):
         """Compute the weighted intersection of c1 and c2.
 
-        If c1 and c2 are None, the output is None, None.
+        If c1 and c2 are None, the output is (0, None).
 
-        if c1 is None and c2 is not None, the output is weight2 and
-        c2.
+        If c1 is None and c2 is not None, the output is (weight2, c2).
 
-        if c1 is not None and c2 not None, the output is weight1 and
-        c1.
+        If c1 is not None and c2 is None, the output is (weight1, c1).
 
         If c1 and c2 are sets, the output is the sum of the weights
         and the (unweighted) intersection of the sets.