summaryrefslogtreecommitdiff
path: root/docs
Commit message (Collapse)AuthorAgeFilesLines
* Fix building of the docs for non-final versions.Michael Howitz2023-04-131-2/+2
|
* 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-253-3/+3
| | | Co-authored-by: Michael Howitz <mh@gocept.com>
* Fix the documentation so it can be tested with ↵Michael Howitz2021-05-052-4/+10
| | | | | `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-253-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 docs/README.rst: Two expressions need two linesJason Madden2021-03-171-1/+2
| | | Co-authored-by: Michael Howitz <mh@gocept.com>
* Update the Adaptation docs to be more concrete.docs-updateJason Madden2021-03-172-81/+147
| | | | | | 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-152-2/+6
| | | | 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 more persistence examples.doc_persistency_equality#218Jason Madden2020-10-231-0/+56
|
* Explore more details of persistence and expand on the motivation for how ↵Jason Madden2020-10-231-65/+162
| | | | this relates to equality/hashing/sorting.
* Add example from #220 to the specification docs and expand it.Jason Madden2020-10-231-8/+97
|
* cosmeticsdieter2020-10-191-0/+1
|
* add exampledieter2020-10-191-1/+28
|
* Document persistency and equalitydieter2020-10-161-0/+37
|
* Add info on the interaction of weakrefs and interface hashing.issue216Jason Madden2020-09-301-0/+64
|
* Special case the base Interface in @implementer/classImplements to skip the ↵Jason Madden2020-04-071-1/+1
| | | | redundancy detection for the sake of plone.app.caching.
* 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.
* Feedback from review: whitespace, doc clarification, and a unit test showing ↵Jason Madden2020-04-071-6/+28
| | | | the precedence of __conform__ vs __adapt__.
* Let interface 'subclasses' override __adapt__.issue3Jason Madden2020-04-062-7/+44
| | | | | | | | | | | | | | | | | | | | 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-062-0/+23
|
* Add more cross refs to documentation and fix a couple sphinx warnings about ↵Jason Madden2020-04-062-2/+17
| | | | duplicates in the index.
* Ensure Interface is the last item in the __sro__.Jason Madden2020-03-181-3/+16
| | | | | | None of the elegant solutions mentioned in the issue worked out, so I had to brute force it. Fixes #8
* Merge pull request #189 from zopefoundation/issue136-issue134Jason Madden2020-03-181-139/+149
|\ | | | | Documentation clarifications.
| * Documentation clarifications.issue136-issue134Jason Madden2020-03-171-139/+149
| | | | | | | | | | | | | | | | | | - docs/adapter.rst Subscriptions are returned from least to most specific, not the other way around; the docs were incorrect. Add additional examples, and use more verbose names in current examples, to clarify this. Fixes #136. - interfaces.py names() and namesAndDescriptions() just return a collection, not a sequence. Fixes #134.
* | 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-183-5/+43
|/ | | | | | | | 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-154-47/+187
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make provided/implementedBy and adapter registries respect super().issue11Jason Madden2020-03-092-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | The query functions now start by looking at the next class in the MRO (interfaces directly provided by the underlying object are not found). Adapter registries automatically pick up providedBy change to start finding the correct implementations of adapters, but to make that really useful they needed to change to unpack super() arguments and pass __self__ to the factory. Fixes #11 Unfortunately, this makes PyPy unable to build the C extensions. Additional crash-safety for adapter lookup. Make the C functions get the cache only after resolving the ``required`` into a tuple, in case of side-effects like...clearing the cache. This could lead to the ``cache`` object being deallocated before we used it. Drop the ``tuplefy`` function in favor of a direct call to ``PySequence_Tuple``. It's what the ``tuple`` constructor would do anyway and saves a few steps. Make sure that getting ``providedBy(super())`` and ``implementedBy(super())`` have no side effects.
* 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
* Simplify the string formatting rules for the Invalid exceptions.Jason Madden2020-02-101-39/+105
| | | | | | As per review. Also include the actual failing implementation object in the BrokenMethodImplementation to make it easier to track down what's going on when inheritance is involved.
* Make verifyObject/Class collect and raise all errors instead of only the first.issue171Jason Madden2020-02-081-23/+41
| | | | Fixes #171.
* Add warning to change note about string changes breaking doctests.Jason Madden2020-02-082-19/+35
| | | | Also tweak documentation to DRY for verifyObject/verifyClass.
* Also document the not-a-method case.issue170Jason Madden2020-02-071-0/+8
|
* Make verification errors more readable and useful.Jason Madden2020-02-071-30/+102
| | | | | | | | | | | | | | Eliminate the trailing newlines and blank spaces (the code called them "a stupid artifact"). Include the name of the defining interface (so the user can easily look up any requirements on the attribute) and, for methods, the expected signature (no more guessing about how many arguments are required!). This is implemented by giving Attribute and Method useful reprs and strs. Previously, they just had the defaults. Fixes #170
* 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-116-160/+187
|
* Update README.ru.rstSerjio Razin2019-02-121-23/+22
| | | | - Punctuation check and fix. - Replace some figures of speech.
* Update README.ru.rstSerjio Razin2019-02-111-1/+1
| | | Fixed typo
* 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-197-301/+398
| | | | Add some missing documentation for the events component registries create.
* Add docstrings with cross-refs to z.i.common.interfacesJason Madden2018-07-191-1/+2
| | | | | | Also bring the ``classImplements`` lines closer to the interface declaration. This helped me be sure that nothing was missed and that all the repetitions of the names matched.