Skip to content

Commit e5cb40d

Browse files
committed
Use zope.interface.implementer instead of zope.interface.implements
1 parent 4792391 commit e5cb40d

File tree

3 files changed

+93
-76
lines changed

3 files changed

+93
-76
lines changed

README.rst

Lines changed: 90 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -343,23 +343,23 @@ summary:
343343
- **Y**: chosen end point
344344
- collision: indicates an invalid combination, that raises a ``PlumbingCollision``
345345

346-
+-------+-------+-------+----------+-------+-----------+
347-
| Attr | Part1 | Part2 | Plumbing | Base | ok? |
348-
+=======+=======+=======+==========+=======+===========+
349-
| K | | | | **x** | |
350-
+-------+-------+-------+----------+-------+-----------+
351-
| L | | | **x** | ? | |
352-
+-------+-------+-------+----------+-------+-----------+
353-
| M | | **f** | | ? | |
354-
+-------+-------+-------+----------+-------+-----------+
355-
| N | **f** | | | ? | |
356-
+-------+-------+-------+----------+-------+-----------+
357-
| O | f | | x | ? | collision |
358-
+-------+-------+-------+----------+-------+-----------+
359-
| P | | f | x | ? | collision |
360-
+-------+-------+-------+----------+-------+-----------+
361-
| Q | f | f | | ? | collision |
362-
+-------+-------+-------+----------+-------+-----------+
346+
+------+-------+-------+----------+-------+-----------+
347+
| Attr | Part1 | Part2 | Plumbing | Base | ok? |
348+
+======+=======+=======+==========+=======+===========+
349+
| K | | | | **x** | |
350+
+------+-------+-------+----------+-------+-----------+
351+
| L | | | **x** | ? | |
352+
+------+-------+-------+----------+-------+-----------+
353+
| M | | **f** | | ? | |
354+
+------+-------+-------+----------+-------+-----------+
355+
| N | **f** | | | ? | |
356+
+------+-------+-------+----------+-------+-----------+
357+
| O | f | | x | ? | collision |
358+
+------+-------+-------+----------+-------+-----------+
359+
| P | | f | x | ? | collision |
360+
+------+-------+-------+----------+-------+-----------+
361+
| Q | f | f | | ? | collision |
362+
+------+-------+-------+----------+-------+-----------+
363363

364364
collisions::
365365

@@ -446,15 +446,15 @@ summary:
446446
- ?: base class declaration is irrelevant
447447
- **Y**: chosen end point
448448

449-
+-------+-------+-------+----------+-------+
450-
| Attr | Part1 | Part2 | Plumbing | Base |
451-
+=======+=======+=======+==========+=======+
452-
| K | e | e | **x** | ? |
453-
+-------+-------+-------+----------+-------+
454-
| L | | **e** | | ? |
455-
+-------+-------+-------+----------+-------+
456-
| M | **e** | e | | ? |
457-
+-------+-------+-------+----------+-------+
449+
+------+-------+-------+----------+------+
450+
| Attr | Part1 | Part2 | Plumbing | Base |
451+
+======+=======+=======+==========+======+
452+
| K | e | e | **x** | ? |
453+
+------+-------+-------+----------+------+
454+
| L | | **e** | | ? |
455+
+------+-------+-------+----------+------+
456+
| M | **e** | e | | ? |
457+
+------+-------+-------+----------+------+
458458

459459
Interaction: ``default``, plumbing declaration and base class
460460
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -493,17 +493,17 @@ summary:
493493
- ? = base class declaration is irrelevant
494494
- **Y** = chosen end point
495495

496-
+-------+-------+-------+----------+-------+
497-
| Attr | Part1 | Part2 | Plumbing | Base |
498-
+=======+=======+=======+==========+=======+
499-
| K | | d | | **x** |
500-
+-------+-------+-------+----------+-------+
501-
| L | | d | **x** | ? |
502-
+-------+-------+-------+----------+-------+
503-
| M | | **d** | | |
504-
+-------+-------+-------+----------+-------+
505-
| N | **d** | d | | |
506-
+-------+-------+-------+----------+-------+
496+
+------+-------+-------+----------+-------+
497+
| Attr | Part1 | Part2 | Plumbing | Base |
498+
+======+=======+=======+==========+=======+
499+
| K | | d | | **x** |
500+
+------+-------+-------+----------+-------+
501+
| L | | d | **x** | ? |
502+
+------+-------+-------+----------+-------+
503+
| M | | **d** | | |
504+
+------+-------+-------+----------+-------+
505+
| N | **d** | d | | |
506+
+------+-------+-------+----------+-------+
507507

508508

509509
Interaction: ``finalize`` wins over ``extend``
@@ -539,13 +539,13 @@ summary:
539539
- ? = base class declaration is irrelevant
540540
- **Y** = chosen end point
541541

542-
+-------+-------+-------+----------+------+
543-
| Attr | Part1 | Part2 | Plumbing | Base |
544-
+=======+=======+=======+==========+======+
545-
| K | e | **f** | | ? |
546-
+-------+-------+-------+----------+------+
547-
| L | **f** | e | | ? |
548-
+-------+-------+-------+----------+------+
542+
+------+-------+-------+----------+------+
543+
| Attr | Part1 | Part2 | Plumbing | Base |
544+
+======+=======+=======+==========+======+
545+
| K | e | **f** | | ? |
546+
+------+-------+-------+----------+------+
547+
| L | **f** | e | | ? |
548+
+------+-------+-------+----------+------+
549549

550550
Interaction: ``finalize`` wins over ``default``:
551551
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -580,13 +580,13 @@ summary:
580580
- ? = base class declaration is irrelevant
581581
- **Y** = chosen end point
582582

583-
+-------+-------+-------+----------+------+
584-
| Attr | Part1 | Part2 | Plumbing | Base |
585-
+=======+=======+=======+==========+======+
586-
| K | d | **f** | | ? |
587-
+-------+-------+-------+----------+------+
588-
| L | **f** | d | | ? |
589-
+-------+-------+-------+----------+------+
583+
+------+-------+-------+----------+------+
584+
| Attr | Part1 | Part2 | Plumbing | Base |
585+
+======+=======+=======+==========+======+
586+
| K | d | **f** | | ? |
587+
+------+-------+-------+----------+------+
588+
| L | **f** | d | | ? |
589+
+------+-------+-------+----------+------+
590590

591591
Interaction: ``extend`` wins over ``default``
592592
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -621,13 +621,13 @@ summary:
621621
- ? = base class declaration is irrelevant
622622
- **Y** = chosen end point
623623

624-
+-------+-------+-------+----------+------+
625-
| Attr | Part1 | Part2 | Plumbing | Base |
626-
+=======+=======+=======+==========+======+
627-
| K | d | **e** | | ? |
628-
+-------+-------+-------+----------+------+
629-
| L | **e** | d | | ? |
630-
+-------+-------+-------+----------+------+
624+
+------+-------+-------+----------+------+
625+
| Attr | Part1 | Part2 | Plumbing | Base |
626+
+======+=======+=======+==========+======+
627+
| K | d | **e** | | ? |
628+
+------+-------+-------+----------+------+
629+
| L | **e** | d | | ? |
630+
+------+-------+-------+----------+------+
631631

632632
Stage 2: Pipeline, docstring and ``zope.interface`` instructions
633633
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -904,15 +904,16 @@ means it will try to import it and if available will check plumbing parts for
904904
implemented interfaces and will make the plumbing implement them, too::
905905

906906
>>> from zope.interface import Interface
907-
>>> from zope.interface import implements
907+
>>> from zope.interface import implementer
908908

909909
A class with an interface that will serve as base class of a plumbing::
910910

911911
>>> class IBase(Interface):
912912
... pass
913913

914-
>>> class Base(object):
915-
... implements(IBase)
914+
>>> @implementer(IBase)
915+
... class Base(object):
916+
... pass
916917

917918
>>> IBase.implementedBy(Base)
918919
True
@@ -923,21 +924,23 @@ implements an interface::
923924
>>> class IPart1(Interface):
924925
... pass
925926

926-
>>> class Part1(Part):
927+
>>> @implementer(IPart1)
928+
... class Part1(Part):
927929
... blub = 1
928-
... implements(IPart1)
929930

930931
>>> class IPart2Base(Interface):
931932
... pass
932933

933-
>>> class Part2Base(Part):
934-
... implements(IPart2Base)
934+
>>> @implementer(IPart2Base)
935+
... class Part2Base(Part):
936+
... pass
935937

936938
>>> class IPart2(Interface):
937939
... pass
938940

939-
>>> class Part2(Part2Base):
940-
... implements(IPart2)
941+
>>> @implementer(IPart2)
942+
... class Part2(Part2Base):
943+
... pass
941944

942945
>>> IPart1.implementedBy(Part1)
943946
True
@@ -954,10 +957,10 @@ A plumbing based on ``Base`` using ``Part1`` and ``Part2`` and implementing
954957
>>> class IPlumbingClass(Interface):
955958
... pass
956959

957-
>>> class PlumbingClass(Base):
960+
>>> @implementer(IPlumbingClass)
961+
... class PlumbingClass(Base):
958962
... __metaclass__ = plumber
959963
... __plumbing__ = Part1, Part2
960-
... implements(IPlumbingClass)
961964

962965
The directly declared and inherited interfaces are implemented::
963966

@@ -1041,15 +1044,15 @@ interfaces for the parts and the class that is created::
10411044
# >>> class IPart1Behaviour(Interface):
10421045
# ... pass
10431046
#
1044-
# >>> class Part1(Part):
1045-
# ... implements(IPart1)
1047+
# >>> @implementer(IPart1)
1048+
# ... class Part1(Part):
10461049
# ... interfaces = (IPart1Behaviour,)
10471050
#
10481051
# >>> class IPart2(Interface):
10491052
# ... pass
10501053
#
1051-
# >>> class Part2(Part):
1052-
# ... implements(IPart2)
1054+
# >>> @implementer(IPart2)
1055+
# ... class Part2(Part):
10531056
# ... interfaces = (IPart2Behaviour,)
10541057
#
10551058
# >>> IUs.implementedBy(Us)
@@ -1131,6 +1134,7 @@ corresponding text.
11311134

11321135
Test Coverage
11331136
^^^^^^^^^^^^^
1137+
11341138
Summary of the test coverage report::
11351139

11361140
lines cov% module (path)
@@ -1145,6 +1149,7 @@ Summary of the test coverage report::
11451149

11461150
Contributors
11471151
^^^^^^^^^^^^
1152+
11481153
- Florian Friesdorf <flo@chaoflow.net>
11491154
- Robert Niederreiter <rnix@squarewave.at>
11501155
- Jens W. Klein <jens@bluedynamics.com>
@@ -1157,6 +1162,18 @@ Contributors
11571162

11581163
Changes
11591164
^^^^^^^
1165+
1166+
1167+
1.1dev
1168+
------
1169+
1170+
- Use ``zope.interface.implementer`` instead of ``zope.interface.implements``.
1171+
[rnix, 2012-05-18]
1172+
1173+
1174+
1.0
1175+
---
1176+
11601177
- ``.. plbnext::`` instead of ``.. plb_next::``
11611178
[chaoflow 2011-02-02]
11621179

README.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/plumber/tests/_globalmetaclasstest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77

88
from zope.interface import Interface
9-
from zope.interface import implements
9+
from zope.interface import implementer
1010

1111
from plumber import plumber
1212
from plumber import Part
@@ -37,8 +37,9 @@ class Foo:
3737
"""
3838

3939

40+
@implementer(IPart1)
4041
class Part1(Part):
41-
implements(IPart1)
42+
pass
4243

4344

4445
class ClassMaybeUsingAPlumbing(object):

0 commit comments

Comments
 (0)