Skip to content
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

Closed
jamadden opened this issue Mar 22, 2020 · 2 comments · Fixed by #159
Closed

Interface definitions outdated #138

jamadden opened this issue Mar 22, 2020 · 2 comments · Fixed by #159

Comments

@jamadden
Copy link
Member

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

@jamadden
Copy link
Member Author

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 (IBtreeModule, IMerge, etc).

>>> 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

@jamadden
Copy link
Member Author

Since nothing is currently actually implementing the interfaces, I think the compatibility risks of using some of the common interfaces from zope.interface.common as bases for these interfaces is relatively minimal.

jamadden added a commit that referenced this issue Mar 31, 2021
- 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
jamadden added a commit that referenced this issue Apr 6, 2021
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant