summaryrefslogtreecommitdiff
path: root/docs/api
Commit message (Collapse)AuthorAgeFilesLines
* Drop support for Python 2.7, 3.5, 3.6. (#266)Michael Howitz2022-12-281-27/+0
| | | Co-authored-by: Jens Vagelpohl <jens@plyp.com>
* Fix typos (#251)Kian-Meng Ang2022-01-251-1/+1
| | | Co-authored-by: Michael Howitz <mh@gocept.com>
* Fix the documentation so it can be tested with ↵Michael Howitz2021-05-051-3/+3
| | | | | `ZOPE_INTERFACE_STRICT_IRO=1`. (#242) Closes #241.
* Make Declaration.__add__ try harder to produce consistent resolution orders.issue193Jason Madden2021-04-011-14/+18
| | | | | | By moving things from the RHS to the front of the list if they already extend something from the LHS. Fixes #193
* Update repr() and str() of some common objects.issue236Jason Madden2021-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only InterfaceClass got a str, so it now has a distinction. Other objects only got updated reprs. Note: This may potentially break some doctests. In many cases, the ``repr()`` is now something that can be evaluated to produce an equal object. For example, what was previously printed as ``<implementedBy builtins.list>`` is now shown as ``classImplements(list, IMutableSequence, IIterable)``. Fixes #236 Here's a before with ZOPE_INTERFACE_LOG_CHANGED_IRO=1 in BTrees: ``` Object <implementedBy builtins.list> has different legacy and C3 MROs: Legacy RO (len=11) C3 RO (len=11; inconsistent=no) ================================================================================================================================================== <implementedBy builtins.list> <implementedBy builtins.list> <ABCInterfaceClass zope.interface.common.collections.IMutableSequence> <ABCInterfaceClass zope.interface.common.collections.IMutableSequence> <ABCInterfaceClass zope.interface.common.collections.ISequence> <ABCInterfaceClass zope.interface.common.collections.ISequence> <ABCInterfaceClass zope.interface.common.collections.IReversible> <ABCInterfaceClass zope.interface.common.collections.IReversible> <ABCInterfaceClass zope.interface.common.collections.ICollection> <ABCInterfaceClass zope.interface.common.collections.ICollection> <ABCInterfaceClass zope.interface.common.collections.ISized> <ABCInterfaceClass zope.interface.common.collections.ISized> + <ABCInterfaceClass zope.interface.common.collections.IIterable> <ABCInterfaceClass zope.interface.common.collections.IContainer> <ABCInterfaceClass zope.interface.common.collections.IContainer> - <ABCInterfaceClass zope.interface.common.collections.IIterable> <ABCInterfaceClass zope.interface.common.ABCInterface> <ABCInterfaceClass zope.interface.common.ABCInterface> + <implementedBy builtins.object> <InterfaceClass zope.interface.Interface> <InterfaceClass zope.interface.Interface> - <implementedBy builtins.object> Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs: Legacy RO (len=18) C3 RO (len=18; inconsistent=no) ================================================================================================================================================ <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> <ABCInterfaceClass zope.interface.common.collections.IMutableMapping> <ABCInterfaceClass zope.interface.common.collections.IMutableMapping> <ABCInterfaceClass zope.interface.common.collections.IMapping> <ABCInterfaceClass zope.interface.common.collections.IMapping> <ABCInterfaceClass zope.interface.common.collections.ICollection> <ABCInterfaceClass zope.interface.common.collections.ICollection> - <ABCInterfaceClass zope.interface.common.collections.IIterable> <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping> <InterfaceClass zope.interface.common.mapping.IExtendedReadMapping> <InterfaceClass zope.interface.common.mapping.IIterableMapping> <InterfaceClass zope.interface.common.mapping.IIterableMapping> <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping> <InterfaceClass zope.interface.common.mapping.IExtendedWriteMapping> <InterfaceClass zope.interface.common.mapping.IClonableMapping> <InterfaceClass zope.interface.common.mapping.IClonableMapping> <InterfaceClass zope.interface.common.mapping.IMapping> <InterfaceClass zope.interface.common.mapping.IMapping> <InterfaceClass zope.interface.common.mapping.IWriteMapping> <InterfaceClass zope.interface.common.mapping.IWriteMapping> <InterfaceClass zope.interface.common.mapping.IEnumerableMapping> <InterfaceClass zope.interface.common.mapping.IEnumerableMapping> <ABCInterfaceClass zope.interface.common.collections.ISized> <ABCInterfaceClass zope.interface.common.collections.ISized> + <ABCInterfaceClass zope.interface.common.collections.IIterable> <InterfaceClass zope.interface.common.mapping.IReadMapping> <InterfaceClass zope.interface.common.mapping.IReadMapping> <ABCInterfaceClass zope.interface.common.collections.IContainer> <ABCInterfaceClass zope.interface.common.collections.IContainer> <ABCInterfaceClass zope.interface.common.ABCInterface> <ABCInterfaceClass zope.interface.common.ABCInterface> <InterfaceClass zope.interface.common.mapping.IItemMapping> <InterfaceClass zope.interface.common.mapping.IItemMapping> <InterfaceClass zope.interface.Interface> <InterfaceClass zope.interface.Interface> Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs: Legacy RO (len=7) C3 RO (len=7; inconsistent=no) ==================================================================================================== <InterfaceClass BTrees.Interfaces.ISet> <InterfaceClass BTrees.Interfaces.ISet> <InterfaceClass BTrees.Interfaces.IKeySequence> <InterfaceClass BTrees.Interfaces.IKeySequence> - <InterfaceClass BTrees.Interfaces.ISized> <InterfaceClass BTrees.Interfaces.ISetMutable> <InterfaceClass BTrees.Interfaces.ISetMutable> <InterfaceClass BTrees.Interfaces.IKeyed> <InterfaceClass BTrees.Interfaces.IKeyed> <InterfaceClass BTrees.Interfaces.ICollection> <InterfaceClass BTrees.Interfaces.ICollection> + <InterfaceClass BTrees.Interfaces.ISized> <InterfaceClass zope.interface.Interface> <InterfaceClass zope.interface.Interface> ``` And here's after: ``` Object classImplements(list, IMutableSequence, IIterable) has different legacy and C3 MROs: Legacy RO (len=11) C3 RO (len=11; inconsistent=no) ========================================================================================================== classImplements(list, IMutableSequence, IIterable) classImplements(list, IMutableSequence, IIterable) zope.interface.common.collections.IMutableSequence zope.interface.common.collections.IMutableSequence zope.interface.common.collections.ISequence zope.interface.common.collections.ISequence zope.interface.common.collections.IReversible zope.interface.common.collections.IReversible zope.interface.common.collections.ICollection zope.interface.common.collections.ICollection zope.interface.common.collections.ISized zope.interface.common.collections.ISized + zope.interface.common.collections.IIterable zope.interface.common.collections.IContainer zope.interface.common.collections.IContainer - zope.interface.common.collections.IIterable zope.interface.common.ABCInterface zope.interface.common.ABCInterface + classImplements(object) zope.interface.Interface zope.interface.Interface - classImplements(object) Object <ABCInterfaceClass zope.interface.common.mapping.IFullMapping> has different legacy and C3 MROs: Legacy RO (len=18) C3 RO (len=18; inconsistent=no) ============================================================================================================ zope.interface.common.mapping.IFullMapping zope.interface.common.mapping.IFullMapping zope.interface.common.collections.IMutableMapping zope.interface.common.collections.IMutableMapping zope.interface.common.collections.IMapping zope.interface.common.collections.IMapping zope.interface.common.collections.ICollection zope.interface.common.collections.ICollection - zope.interface.common.collections.IIterable zope.interface.common.mapping.IExtendedReadMapping zope.interface.common.mapping.IExtendedReadMapping zope.interface.common.mapping.IIterableMapping zope.interface.common.mapping.IIterableMapping zope.interface.common.mapping.IExtendedWriteMapping zope.interface.common.mapping.IExtendedWriteMapping zope.interface.common.mapping.IClonableMapping zope.interface.common.mapping.IClonableMapping zope.interface.common.mapping.IMapping zope.interface.common.mapping.IMapping zope.interface.common.mapping.IWriteMapping zope.interface.common.mapping.IWriteMapping zope.interface.common.mapping.IEnumerableMapping zope.interface.common.mapping.IEnumerableMapping zope.interface.common.collections.ISized zope.interface.common.collections.ISized + zope.interface.common.collections.IIterable zope.interface.common.mapping.IReadMapping zope.interface.common.mapping.IReadMapping zope.interface.common.collections.IContainer zope.interface.common.collections.IContainer zope.interface.common.ABCInterface zope.interface.common.ABCInterface zope.interface.common.mapping.IItemMapping zope.interface.common.mapping.IItemMapping zope.interface.Interface zope.interface.Interface Object <InterfaceClass BTrees.Interfaces.ISet> has different legacy and C3 MROs: Legacy RO (len=7) C3 RO (len=7; inconsistent=no) ================================================================== BTrees.Interfaces.ISet BTrees.Interfaces.ISet BTrees.Interfaces.IKeySequence BTrees.Interfaces.IKeySequence - BTrees.Interfaces.ISized BTrees.Interfaces.ISetMutable BTrees.Interfaces.ISetMutable BTrees.Interfaces.IKeyed BTrees.Interfaces.IKeyed BTrees.Interfaces.ICollection BTrees.Interfaces.ICollection + BTrees.Interfaces.ISized zope.interface.Interface zope.interface.Interface ```
* Update the Adaptation docs to be more concrete.docs-updateJason Madden2021-03-171-1/+1
| | | | | | This should help provide better motivating use cases. Examples inspired by https://glyph.twistedmatrix.com/2021/03/interfaces-and-protocols.html Also some minor typo fixes and updates to comments.
* Move itertools import to module scope.issue224Jason Madden2021-03-151-1/+1
| | | | Also tweak docs.
* Let subclasses of BaseAdapterRegistry customize the data structures.Jason Madden2021-03-031-0/+14
| | | | | | | | | | | | Add extensive tests for this. Fixes #224. Also adds test for, and fixes #227 Add BAR.rebuild() to fix the refcount issue, and to change datatypes. It works by using the new methods allRegistrations() and allSubscriptions() to re-create the data in new data structures. This makes fresh calls to subscribe() and register(). I went this way instead of trying to manually walk the data structures and create them because the logic in those methods is fully tested.
* Add example from #220 to the specification docs and expand it.Jason Madden2020-10-231-8/+97
|
* Add info on the interaction of weakrefs and interface hashing.issue216Jason Madden2020-09-301-0/+64
|
* Make @implementer and classImplements not re-declare redundant interfaces.Jason Madden2020-04-071-7/+10
| | | | classImplementsOnly and @implementer_only can still be used to do that.
* Let interface 'subclasses' override __adapt__.issue3Jason Madden2020-04-061-0/+2
| | | | | | | | | | | | | | | | | | | | Cooperate with InterfaceClass to ensure there is no performance penalty for this. Fixes #3 +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | Benchmark | bench_master38 | bench_issue3 | bench_issue3_opt | +=============================================================+================+==============================+==============================+ | call interface (provides; deep) | 369 ns | 454 ns: 1.23x slower (+23%) | not significant | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | call interface (provides; wide) | 373 ns | 457 ns: 1.22x slower (+22%) | 365 ns: 1.02x faster (-2%) | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | call interface (no alternate, no conform, not provided) | 671 ns | 760 ns: 1.13x slower (+13%) | 636 ns: 1.06x faster (-5%) | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | call interface (alternate, no conform, not provided) | 395 ns | 494 ns: 1.25x slower (+25%) | not significant | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | call interface (no alternate, valid conform, not provided) | 250 ns | not significant | 227 ns: 1.10x faster (-9%) | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+ | call interface (alternate, invalid conform, not provided) | 348 ns | 424 ns: 1.22x slower (+22%) | not significant | +-------------------------------------------------------------+----------------+------------------------------+------------------------------+
* Add documentation for taggedValue and invariant.Jason Madden2020-04-061-0/+18
|
* More minor documentation fixups.issue190Jason Madden2020-03-181-2/+5
| | | | Mostly formatting. Some interfaces were being documented as clasess, which doesn't work.
* Make Interface.getTaggedValue follow the __iro__.Jason Madden2020-03-182-5/+21
| | | | | | | | Previously it manually walked up __bases__, meaning the answers could be inconsistent. Fixes #190. Also fixes several minor issues in the documentation, mostly cross-reference related.
* Use C3 (mostly) to compute IRO.issue21Jason Madden2020-03-153-31/+157
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #21 The 'mostly' is because interfaces are used in cases that C3 forbids; when there's a conflict, we fallback to the legacy algorithm. It turns out there are few conflicts (13K out of 149K total orderings in Plone). I hoped the fix for #8 might shake out automatically, but it didn't. Optimize the extremely common case of a __bases__ of length one. In the benchmark, 4/5 of the interfaces and related objects have a base of length one. Fix the bad IROs in the bundled ABC interfaces, and implement a way to get warnings or errors. In running plone/buildout.coredev and tracking the RO requests, the stats for equal, not equal, and inconsistent-so-fallback, I got {'ros': 148868, 'eq': 138461, 'ne': 10407, 'inconsistent': 12934} Add the interface module to the Attribute str. This was extremely helpful tracking down the Plone problem; IDate is defined in multiple modules.
* Update documentation and clarify the relationship of the older mapping and ↵Jason Madden2020-02-171-15/+17
| | | | sequence interfaces.
* Add interfaces for builtins and the io ABCs.Jason Madden2020-02-171-0/+10
|
* Add numbers ABC interfaces.Jason Madden2020-02-171-0/+5
|
* Add z.i.common.collections to parallel the collections.abc classes.Jason Madden2020-02-171-0/+5
| | | | | | | | Register implemented standard library types on import. Derive the interface methods and documentation from the ABC automatically. I hope to use this for numbers too. Part of #138
* Use .. caution:: to warn about the the old class-advice based APIsdocs-in-py3Marius Gedminas2019-11-111-3/+3
|
* Move the @provider example into the right sectionMarius Gedminas2019-11-111-9/+8
| | | | | | | | | Explain that implements()/implementsOnly()/classProvides() not only should not be "preferred", but are entirely not functional on Python 3. (These notes should probably use some Sphinx directive to stand out better, but I'm not well versed in Sphinx and I don't know which one I should use.)
* Port the documentation examples to Python 3Marius Gedminas2019-11-112-55/+79
|
* Cross ref from ISpecification to IDeclaration.Jason Madden2018-07-191-13/+14
|
* Reorganize the 'declarations' document by functional group.Jason Madden2018-07-191-489/+401
| | | | Add cross references and some formatting fixes.
* Formatting and cross refs for the 'Interface Specification' docJason Madden2018-07-191-12/+28
|
* Formatting and cross refs for IComponents.Jason Madden2018-07-191-1/+8
|
* Basic API reference documentation reorg: split into four functional parts.Jason Madden2018-07-196-0/+1230
Add some missing documentation for the events component registries create.