-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interface definitions outdated #138
Comments
It's worse than that. None of the BTree objects actually implement/provide any of the interfaces defined here. The only interfaces that are actually implemented are at the module level ( >>> from zope.interface import *
>>> from BTrees import family64
>>> list(providedBy(family64.OO).flattened())
[<InterfaceClass BTrees.Interfaces.IObjectObjectBTreeModule>,
<InterfaceClass BTrees.Interfaces.IBTreeModule>,
<InterfaceClass BTrees.Interfaces.IMerge>,
<InterfaceClass zope.interface.Interface>]
>>> list(providedBy(family64.OO.BTreePy()).flattened())
[<InterfaceClass persistent.interfaces.IPersistent>,
<InterfaceClass zope.interface.Interface>]
>>> list(providedBy(family64.OO.BTree()).flattened())
[<InterfaceClass persistent.interfaces.IPersistent>,
<InterfaceClass zope.interface.Interface>]
>>> list(providedBy(family64.II.BTree()).flattened())
[<InterfaceClass persistent.interfaces.IPersistent>,
<InterfaceClass zope.interface.Interface>]
>>> list(providedBy(family64.II.Set()).flattened())
[<InterfaceClass persistent.interfaces.IPersistent>,
<InterfaceClass zope.interface.Interface>]
>>> from BTrees.Interfaces import IBTree
>>> IBTree.providedBy(family64.OO.BTree())
False |
Since nothing is currently actually implementing the interfaces, I think the compatibility risks of using some of the common interfaces from |
- Make the BTree objects (BTree, TreeSet, Set, Bucket) of each module actually provide the interfaces defined in BTrees.Interfaces. Previously, they provided no interfaces. - Update the definitions of ISized and IReadSequence to simply be zope.interface.common.collections.ISized and zope.interface.common.sequence.IMinimalSequence respectively. - Remove the __nonzero__ interface method from ICollection. No objects actually implemented such a method; instead, the boolean value is typically taken from __len__. Fixes #138
- Make the BTree objects (BTree, TreeSet, Set, Bucket) of each module actually provide the interfaces defined in BTrees.Interfaces. Previously, they provided no interfaces. - Update the definitions of ISized and IReadSequence to simply be zope.interface.common.collections.ISized and zope.interface.common.sequence.IMinimalSequence respectively. - Remove the __nonzero__ interface method from ICollection. No objects actually implemented such a method; instead, the boolean value is typically taken from __len__. Fixes #138
For example, they refer to
__nonzero__
and__getslice__
on all versions of Python.I suspect many of the low-level interfaces defined here could be replaced by the corresponding interfaces from
zope.interface.common.collections
.cf #128
The text was updated successfully, but these errors were encountered: