Commit b8d2190f authored by Tim Peters's avatar Tim Peters

Collector 1829.

Clarified that the ``minKey()`` and ``maxKey()`` methods raise an exception
if no key exists satsifying the constraints.

Also improved the English in other interface docstrings.
parent 273aad4d
...@@ -5,6 +5,7 @@ Release date: DD-MMM-2005 ...@@ -5,6 +5,7 @@ Release date: DD-MMM-2005
Following are dates of internal releases (to support ongoing Zope 2 Following are dates of internal releases (to support ongoing Zope 2
development) since ZODB 3.4's last public release: development) since ZODB 3.4's last public release:
- 3.4.1a3 DD-MMM-2005
- 3.4.1a2 29-Jun-2005 - 3.4.1a2 29-Jun-2005
- 3.4.1a1 27-Jun-2005 - 3.4.1a1 27-Jun-2005
...@@ -55,6 +56,12 @@ DemoStorage ...@@ -55,6 +56,12 @@ DemoStorage
- The implementation of ``undoLog()`` was wrong in several ways; repaired. - The implementation of ``undoLog()`` was wrong in several ways; repaired.
BTrees interface
----------------
- (3.4.1a3) Collector 1829. Clarified that the ``minKey()`` and ``maxKey()``
methods raise an exception if no key exists satsifying the constraints.
What's new in ZODB3 3.4? What's new in ZODB3 3.4?
======================== ========================
......
...@@ -18,32 +18,31 @@ from zope.interface import Interface ...@@ -18,32 +18,31 @@ from zope.interface import Interface
class ICollection(Interface): class ICollection(Interface):
def clear(): def clear():
"""Remove all of the items from the collection""" """Remove all of the items from the collection."""
def __nonzero__(): def __nonzero__():
"""Check if the collection is non-empty. """Check if the collection is non-empty.
Return a true value if the collection is non-empty and a Return a true value if the collection is non-empty and a
false otherwise. false value otherwise.
""" """
class IReadSequence(Interface): class IReadSequence(Interface):
def __getitem__(index): def __getitem__(index):
"""Return a value at the given index """Return the value at the given index.
An IndexError is raised if the index cannot be found. An IndexError is raised if the index cannot be found.
""" """
def __getslice__(index1, index2): def __getslice__(index1, index2):
"""Return a subsequence from the original sequence """Return a subsequence from the original sequence.
Such that the subsequence includes the items from index1 up The subsequence includes the items from index1 up to, but not
to, but not including, index2. including, index2.
""" """
class IKeyed(ICollection): class IKeyed(ICollection):
def has_key(key): def has_key(key):
...@@ -75,17 +74,19 @@ class IKeyed(ICollection): ...@@ -75,17 +74,19 @@ class IKeyed(ICollection):
""" """
def maxKey(key=None): def maxKey(key=None):
"""Return the maximum key """Return the maximum key.
If a key argument if provided, return the largest key that is If a key argument if provided and not None, return the largest key
less than or equal to the argument. that is less than or equal to the argument. Raise an exception if
no such key exists.
""" """
def minKey(key=None): def minKey(key=None):
"""Return the minimum key """Return the minimum key.
If a key argument if provided, return the smallest key that is If a key argument if provided and not None, return the smallest key
greater than or equal to the argument. that is greater than or equal to the argument. Raise an exception
if no such key exists.
""" """
...@@ -131,18 +132,18 @@ class ITreeSet(IKeyed, ISetMutable): ...@@ -131,18 +132,18 @@ class ITreeSet(IKeyed, ISetMutable):
class IMinimalDictionary(ISized, IKeyed): class IMinimalDictionary(ISized, IKeyed):
def get(key, default): def get(key, default):
"""Get the value for the given key """Get the value associated with the given key.
Return the default if the key is not in the collection. Return the default if has_key(key) is false.
""" """
def __setitem__(key, value): def __setitem__(key, value):
"""Set the value for the given key.""" """Set the value associated with the given key."""
def __delitem__(key): def __delitem__(key):
"""Delete the value for the given key. """Delete the value associated with the given key.
Raise KeyError if the key if not in the collection. Raise KeyError if the key if has_key(key) is false.
""" """
def values(min=None, max=None, excludemin=False, excludemax=False): def values(min=None, max=None, excludemin=False, excludemax=False):
...@@ -200,20 +201,19 @@ class IDictionaryIsh(IMinimalDictionary): ...@@ -200,20 +201,19 @@ class IDictionaryIsh(IMinimalDictionary):
def update(collection): def update(collection):
"""Add the items from the given collection object to the collection. """Add the items from the given collection object to the collection.
The input collection must be a sequence of key-value tuples, The input collection must be a sequence of (key, value) 2-tuples,
or an object with an 'items' method that returns a sequence of or an object with an 'items' method that returns a sequence of
key-value tuples. (key, value) pairs.
""" """
def byValue(minValue): def byValue(minValue):
"""Return a sequence of value-key pairs, sorted by value """Return a sequence of (value, key) pairs, sorted by value.
Values < min are ommitted and other values are "normalized" by Values < minValue are omitted and other values are "normalized" by
the minimum value. This normalization may be a noop, but, for the minimum value. This normalization may be a noop, but, for
integer values, the normalization is division. integer values, the normalization is division.
""" """
class IBTree(IDictionaryIsh): class IBTree(IDictionaryIsh):
def insert(key, value): def insert(key, value):
...@@ -230,7 +230,7 @@ class IBTree(IDictionaryIsh): ...@@ -230,7 +230,7 @@ class IBTree(IDictionaryIsh):
A standard idiom for generating new keys will be:: A standard idiom for generating new keys will be::
key=generate_key() key = generate_key()
while not t.insert(key, value): while not t.insert(key, value):
key=generate_key() key=generate_key()
""" """
...@@ -255,8 +255,7 @@ class IMerge(Interface): ...@@ -255,8 +255,7 @@ class IMerge(Interface):
""" """
def difference(c1, c2): def difference(c1, c2):
"""Return the keys or items in c1 for which there is no key in """Return the keys or items in c1 for which there is no key in c2.
c2.
If c1 is None, then None is returned. If c2 is None, then c1 If c1 is None, then None is returned. If c2 is None, then c1
is returned. is returned.
......
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