Show More
@@ -48,42 +48,45 b' The package has several public modules:' | |||||
48 |
|
48 | |||
49 | See the module doc strings for more information. |
|
49 | See the module doc strings for more information. | |
50 | """ |
|
50 | """ | |
|
51 | ||||
|
52 | from __future__ import absolute_import | |||
|
53 | ||||
51 | __docformat__ = 'restructuredtext' |
|
54 | __docformat__ = 'restructuredtext' | |
52 |
|
55 | |||
53 |
from |
|
56 | from .interface import Interface | |
54 |
from |
|
57 | from .interface import _wire | |
55 |
|
58 | |||
56 | # Need to actually get the interface elements to implement the right interfaces |
|
59 | # Need to actually get the interface elements to implement the right interfaces | |
57 | _wire() |
|
60 | _wire() | |
58 | del _wire |
|
61 | del _wire | |
59 |
|
62 | |||
60 |
from |
|
63 | from .declarations import Declaration | |
61 |
from |
|
64 | from .declarations import alsoProvides | |
62 |
from |
|
65 | from .declarations import classImplements | |
63 |
from |
|
66 | from .declarations import classImplementsOnly | |
64 |
from |
|
67 | from .declarations import classProvides | |
65 |
from |
|
68 | from .declarations import directlyProvidedBy | |
66 |
from |
|
69 | from .declarations import directlyProvides | |
67 |
from |
|
70 | from .declarations import implementedBy | |
68 |
from |
|
71 | from .declarations import implementer | |
69 |
from |
|
72 | from .declarations import implementer_only | |
70 |
from |
|
73 | from .declarations import implements | |
71 |
from |
|
74 | from .declarations import implementsOnly | |
72 |
from |
|
75 | from .declarations import moduleProvides | |
73 |
from |
|
76 | from .declarations import named | |
74 |
from |
|
77 | from .declarations import noLongerProvides | |
75 |
from |
|
78 | from .declarations import providedBy | |
76 |
from |
|
79 | from .declarations import provider | |
77 |
from |
|
80 | from .exceptions import Invalid | |
78 |
from |
|
81 | from .interface import Attribute | |
79 |
from |
|
82 | from .interface import invariant | |
80 |
from |
|
83 | from .interface import taggedValue | |
81 |
|
84 | |||
82 | # The following are to make spec pickles cleaner |
|
85 | # The following are to make spec pickles cleaner | |
83 |
from |
|
86 | from .declarations import Provides | |
84 |
|
87 | |||
85 |
|
88 | |||
86 |
from |
|
89 | from .interfaces import IInterfaceDeclaration | |
87 |
|
90 | |||
88 | moduleProvides(IInterfaceDeclaration) |
|
91 | moduleProvides(IInterfaceDeclaration) | |
89 |
|
92 |
@@ -13,6 +13,8 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Basic components support |
|
14 | """Basic components support | |
15 | """ |
|
15 | """ | |
|
16 | from __future__ import absolute_import | |||
|
17 | ||||
16 | import sys |
|
18 | import sys | |
17 | import types |
|
19 | import types | |
18 |
|
20 |
@@ -15,7 +15,10 b'' | |||||
15 |
|
15 | |||
16 | See Adapter class. |
|
16 | See Adapter class. | |
17 | """ |
|
17 | """ | |
18 | from zope.interface import Declaration |
|
18 | ||
|
19 | from __future__ import absolute_import | |||
|
20 | ||||
|
21 | from .interface import Declaration | |||
19 |
|
22 | |||
20 | def _flatten(implements, include_None=0): |
|
23 | def _flatten(implements, include_None=0): | |
21 |
|
24 |
@@ -47,7 +47,8 b' import_declarations(void)' | |||||
47 | { |
|
47 | { | |
48 | PyObject *declarations, *i; |
|
48 | PyObject *declarations, *i; | |
49 |
|
49 | |||
50 |
declarations = PyImport_ImportModule( |
|
50 | declarations = PyImport_ImportModule( | |
|
51 | "mercurial.thirdparty.zope.interface.declarations"); | |||
51 | if (declarations == NULL) |
|
52 | if (declarations == NULL) | |
52 | return -1; |
|
53 | return -1; | |
53 |
|
54 | |||
@@ -1336,7 +1337,7 b' verifying_clear(verify *self)' | |||||
1336 | static void |
|
1337 | static void | |
1337 | verifying_dealloc(verify *self) |
|
1338 | verifying_dealloc(verify *self) | |
1338 | { |
|
1339 | { | |
1339 |
PyObject_GC_UnTrack((PyObject *)self); |
|
1340 | PyObject_GC_UnTrack((PyObject *)self); | |
1340 | verifying_clear(self); |
|
1341 | verifying_clear(self); | |
1341 | Py_TYPE(self)->tp_free((PyObject*)self); |
|
1342 | Py_TYPE(self)->tp_free((PyObject*)self); | |
1342 | } |
|
1343 | } |
@@ -13,16 +13,18 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Adapter management |
|
14 | """Adapter management | |
15 | """ |
|
15 | """ | |
|
16 | from __future__ import absolute_import | |||
|
17 | ||||
16 | import weakref |
|
18 | import weakref | |
17 |
|
19 | |||
18 |
from |
|
20 | from . import implementer | |
19 |
from |
|
21 | from . import providedBy | |
20 |
from |
|
22 | from . import Interface | |
21 |
from |
|
23 | from . import ro | |
22 |
from |
|
24 | from .interfaces import IAdapterRegistry | |
23 |
|
25 | |||
24 |
from |
|
26 | from ._compat import _normalize_name | |
25 |
from |
|
27 | from ._compat import STRING_TYPES | |
26 |
|
28 | |||
27 | _BLANK = u'' |
|
29 | _BLANK = u'' | |
28 |
|
30 | |||
@@ -409,7 +411,7 b' class LookupBaseFallback(object):' | |||||
409 | LookupBasePy = LookupBaseFallback # BBB |
|
411 | LookupBasePy = LookupBaseFallback # BBB | |
410 |
|
412 | |||
411 | try: |
|
413 | try: | |
412 |
from |
|
414 | from ._zope_interface_coptimizations import LookupBase | |
413 | except ImportError: |
|
415 | except ImportError: | |
414 | LookupBase = LookupBaseFallback |
|
416 | LookupBase = LookupBaseFallback | |
415 |
|
417 | |||
@@ -445,7 +447,7 b' class VerifyingBaseFallback(LookupBaseFa' | |||||
445 | VerifyingBasePy = VerifyingBaseFallback #BBB |
|
447 | VerifyingBasePy = VerifyingBaseFallback #BBB | |
446 |
|
448 | |||
447 | try: |
|
449 | try: | |
448 |
from |
|
450 | from ._zope_interface_coptimizations import VerifyingBase | |
449 | except ImportError: |
|
451 | except ImportError: | |
450 | VerifyingBase = VerifyingBaseFallback |
|
452 | VerifyingBase = VerifyingBaseFallback | |
451 |
|
453 |
@@ -25,6 +25,8 b' models, object-relational persistence, a' | |||||
25 | Visit the PEAK home page at http://peak.telecommunity.com for more information. |
|
25 | Visit the PEAK home page at http://peak.telecommunity.com for more information. | |
26 | """ |
|
26 | """ | |
27 |
|
27 | |||
|
28 | from __future__ import absolute_import | |||
|
29 | ||||
28 | from types import FunctionType |
|
30 | from types import FunctionType | |
29 | try: |
|
31 | try: | |
30 | from types import ClassType |
|
32 | from types import ClassType |
@@ -1,7 +1,7 b'' | |||||
1 | ############################################################################## |
|
1 | ############################################################################## | |
2 | # Copyright (c) 2002 Zope Foundation and Contributors. |
|
2 | # Copyright (c) 2002 Zope Foundation and Contributors. | |
3 | # All Rights Reserved. |
|
3 | # All Rights Reserved. | |
4 |
# |
|
4 | # | |
5 | # This software is subject to the provisions of the Zope Public License, |
|
5 | # This software is subject to the provisions of the Zope Public License, | |
6 | # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
|
6 | # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | |
7 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
|
7 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | |
@@ -15,8 +15,10 b' This module is called idatetime because ' | |||||
15 | of the real datetime would fail. |
|
15 | of the real datetime would fail. | |
16 | """ |
|
16 | """ | |
17 |
|
17 | |||
18 | from zope.interface import Interface, Attribute |
|
18 | from __future__ import absolute_import | |
19 | from zope.interface import classImplements |
|
19 | ||
|
20 | from .. import Interface, Attribute | |||
|
21 | from .. import classImplements | |||
20 |
|
22 | |||
21 | from datetime import timedelta, date, datetime, time, tzinfo |
|
23 | from datetime import timedelta, date, datetime, time, tzinfo | |
22 |
|
24 | |||
@@ -112,7 +114,7 b' class IDate(IDateClass):' | |||||
112 |
|
114 | |||
113 | Except for those members given new values by whichever keyword |
|
115 | Except for those members given new values by whichever keyword | |
114 | arguments are specified. For example, if d == date(2002, 12, 31), then |
|
116 | arguments are specified. For example, if d == date(2002, 12, 31), then | |
115 |
d.replace(day=26) == date(2000, 12, 26). |
|
117 | d.replace(day=26) == date(2000, 12, 26). | |
116 | """ |
|
118 | """ | |
117 |
|
119 | |||
118 | def timetuple(): |
|
120 | def timetuple(): | |
@@ -232,7 +234,7 b' class IDateTimeClass(Interface):' | |||||
232 | """Return the current UTC date and time, with tzinfo None. |
|
234 | """Return the current UTC date and time, with tzinfo None. | |
233 |
|
235 | |||
234 | This is like now(), but returns the current UTC date and time, as a |
|
236 | This is like now(), but returns the current UTC date and time, as a | |
235 |
naive datetime object. |
|
237 | naive datetime object. | |
236 |
|
238 | |||
237 | See also now(). |
|
239 | See also now(). | |
238 | """ |
|
240 | """ | |
@@ -357,7 +359,7 b' class IDateTime(IDate, IDateTimeClass):' | |||||
357 | If you merely want to attach a time zone object tz to a datetime dt |
|
359 | If you merely want to attach a time zone object tz to a datetime dt | |
358 | without adjustment of date and time members, use dt.replace(tzinfo=tz). |
|
360 | without adjustment of date and time members, use dt.replace(tzinfo=tz). | |
359 | If you merely want to remove the time zone object from an aware |
|
361 | If you merely want to remove the time zone object from an aware | |
360 |
datetime dt without conversion of date and time members, use |
|
362 | datetime dt without conversion of date and time members, use | |
361 | dt.replace(tzinfo=None). |
|
363 | dt.replace(tzinfo=None). | |
362 |
|
364 | |||
363 | Note that the default tzinfo.fromutc() method can be overridden in a |
|
365 | Note that the default tzinfo.fromutc() method can be overridden in a |
@@ -13,8 +13,11 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Interfaces for standard python exceptions |
|
14 | """Interfaces for standard python exceptions | |
15 | """ |
|
15 | """ | |
16 | from zope.interface import Interface |
|
16 | ||
17 | from zope.interface import classImplements |
|
17 | from __future__ import absolute_import | |
|
18 | ||||
|
19 | from .. import Interface | |||
|
20 | from .. import classImplements | |||
18 |
|
21 | |||
19 | class IException(Interface): pass |
|
22 | class IException(Interface): pass | |
20 | class IStandardError(IException): pass |
|
23 | class IStandardError(IException): pass |
@@ -13,7 +13,10 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Mapping Interfaces |
|
14 | """Mapping Interfaces | |
15 | """ |
|
15 | """ | |
16 | from zope.interface import Interface |
|
16 | ||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
|
19 | from .. import Interface | |||
17 |
|
20 | |||
18 | class IItemMapping(Interface): |
|
21 | class IItemMapping(Interface): | |
19 | """Simplest readable mapping object |
|
22 | """Simplest readable mapping object | |
@@ -42,13 +45,13 b' class IReadMapping(IItemMapping):' | |||||
42 |
|
45 | |||
43 | class IWriteMapping(Interface): |
|
46 | class IWriteMapping(Interface): | |
44 | """Mapping methods for changing data""" |
|
47 | """Mapping methods for changing data""" | |
45 |
|
48 | |||
46 | def __delitem__(key): |
|
49 | def __delitem__(key): | |
47 | """Delete a value from the mapping using the key.""" |
|
50 | """Delete a value from the mapping using the key.""" | |
48 |
|
51 | |||
49 | def __setitem__(key, value): |
|
52 | def __setitem__(key, value): | |
50 | """Set a new item in the mapping.""" |
|
53 | """Set a new item in the mapping.""" | |
51 |
|
54 | |||
52 |
|
55 | |||
53 | class IEnumerableMapping(IReadMapping): |
|
56 | class IEnumerableMapping(IReadMapping): | |
54 | """Mapping objects whose items can be enumerated. |
|
57 | """Mapping objects whose items can be enumerated. | |
@@ -89,32 +92,32 b' class IIterableMapping(IEnumerableMappin' | |||||
89 | "iterate over items" |
|
92 | "iterate over items" | |
90 |
|
93 | |||
91 | class IClonableMapping(Interface): |
|
94 | class IClonableMapping(Interface): | |
92 |
|
95 | |||
93 | def copy(): |
|
96 | def copy(): | |
94 | "return copy of dict" |
|
97 | "return copy of dict" | |
95 |
|
98 | |||
96 | class IExtendedReadMapping(IIterableMapping): |
|
99 | class IExtendedReadMapping(IIterableMapping): | |
97 |
|
100 | |||
98 | def has_key(key): |
|
101 | def has_key(key): | |
99 | """Tell if a key exists in the mapping; equivalent to __contains__""" |
|
102 | """Tell if a key exists in the mapping; equivalent to __contains__""" | |
100 |
|
103 | |||
101 | class IExtendedWriteMapping(IWriteMapping): |
|
104 | class IExtendedWriteMapping(IWriteMapping): | |
102 |
|
105 | |||
103 | def clear(): |
|
106 | def clear(): | |
104 | "delete all items" |
|
107 | "delete all items" | |
105 |
|
108 | |||
106 | def update(d): |
|
109 | def update(d): | |
107 | " Update D from E: for k in E.keys(): D[k] = E[k]" |
|
110 | " Update D from E: for k in E.keys(): D[k] = E[k]" | |
108 |
|
111 | |||
109 | def setdefault(key, default=None): |
|
112 | def setdefault(key, default=None): | |
110 | "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D" |
|
113 | "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D" | |
111 |
|
114 | |||
112 | def pop(k, *args): |
|
115 | def pop(k, *args): | |
113 | """remove specified key and return the corresponding value |
|
116 | """remove specified key and return the corresponding value | |
114 | *args may contain a single default value, or may not be supplied. |
|
117 | *args may contain a single default value, or may not be supplied. | |
115 |
If key is not found, default is returned if given, otherwise |
|
118 | If key is not found, default is returned if given, otherwise | |
116 | KeyError is raised""" |
|
119 | KeyError is raised""" | |
117 |
|
120 | |||
118 | def popitem(): |
|
121 | def popitem(): | |
119 | """remove and return some (key, value) pair as a |
|
122 | """remove and return some (key, value) pair as a | |
120 | 2-tuple; but raise KeyError if mapping is empty""" |
|
123 | 2-tuple; but raise KeyError if mapping is empty""" |
@@ -13,8 +13,11 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Sequence Interfaces |
|
14 | """Sequence Interfaces | |
15 | """ |
|
15 | """ | |
|
16 | ||||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
16 | __docformat__ = 'restructuredtext' |
|
19 | __docformat__ = 'restructuredtext' | |
17 |
from |
|
20 | from .. import Interface | |
18 |
|
21 | |||
19 | class IMinimalSequence(Interface): |
|
22 | class IMinimalSequence(Interface): | |
20 | """Most basic sequence interface. |
|
23 | """Most basic sequence interface. |
@@ -24,6 +24,8 b' There are three flavors of declarations:' | |||||
24 | provided by objects. |
|
24 | provided by objects. | |
25 |
|
25 | |||
26 | """ |
|
26 | """ | |
|
27 | from __future__ import absolute_import | |||
|
28 | ||||
27 | __docformat__ = 'restructuredtext' |
|
29 | __docformat__ = 'restructuredtext' | |
28 |
|
30 | |||
29 | import sys |
|
31 | import sys | |
@@ -32,12 +34,12 b' from types import MethodType' | |||||
32 | from types import ModuleType |
|
34 | from types import ModuleType | |
33 | import weakref |
|
35 | import weakref | |
34 |
|
36 | |||
35 |
from |
|
37 | from .advice import addClassAdvisor | |
36 |
from |
|
38 | from .interface import InterfaceClass | |
37 |
from |
|
39 | from .interface import SpecificationBase | |
38 |
from |
|
40 | from .interface import Specification | |
39 |
from |
|
41 | from ._compat import CLASS_TYPES as DescriptorAwareMetaClasses | |
40 |
from |
|
42 | from ._compat import PYTHON3 | |
41 |
|
43 | |||
42 | # Registry of class-implementation specifications |
|
44 | # Registry of class-implementation specifications | |
43 | BuiltinImplementationSpecifications = {} |
|
45 | BuiltinImplementationSpecifications = {} | |
@@ -638,11 +640,11 b' ClassProvidesBase = ClassProvidesBaseFal' | |||||
638 |
|
640 | |||
639 | # Try to get C base: |
|
641 | # Try to get C base: | |
640 | try: |
|
642 | try: | |
641 |
import |
|
643 | from . import _zope_interface_coptimizations | |
642 | except ImportError: |
|
644 | except ImportError: | |
643 | pass |
|
645 | pass | |
644 | else: |
|
646 | else: | |
645 |
from |
|
647 | from ._zope_interface_coptimizations import ClassProvidesBase | |
646 |
|
648 | |||
647 |
|
649 | |||
648 | class ClassProvides(Declaration, ClassProvidesBase): |
|
650 | class ClassProvides(Declaration, ClassProvidesBase): | |
@@ -915,15 +917,15 b' def _normalizeargs(sequence, output = No' | |||||
915 | _empty = Declaration() |
|
917 | _empty = Declaration() | |
916 |
|
918 | |||
917 | try: |
|
919 | try: | |
918 |
import |
|
920 | from . import _zope_interface_coptimizations | |
919 | except ImportError: |
|
921 | except ImportError: | |
920 | pass |
|
922 | pass | |
921 | else: |
|
923 | else: | |
922 |
from |
|
924 | from ._zope_interface_coptimizations import implementedBy | |
923 |
from |
|
925 | from ._zope_interface_coptimizations import providedBy | |
924 |
from |
|
926 | from ._zope_interface_coptimizations import ( | |
925 | getObjectSpecification) |
|
927 | getObjectSpecification) | |
926 |
from |
|
928 | from ._zope_interface_coptimizations import ( | |
927 | ObjectSpecificationDescriptor) |
|
929 | ObjectSpecificationDescriptor) | |
928 |
|
930 | |||
929 | objectSpecificationDescriptor = ObjectSpecificationDescriptor() |
|
931 | objectSpecificationDescriptor = ObjectSpecificationDescriptor() |
@@ -16,8 +16,10 b'' | |||||
16 | This module provides a function, asStructuredText, for rendering an |
|
16 | This module provides a function, asStructuredText, for rendering an | |
17 | interface as structured text. |
|
17 | interface as structured text. | |
18 | """ |
|
18 | """ | |
19 | import zope.interface |
|
|||
20 |
|
19 | |||
|
20 | from __future__ import absolute_import | |||
|
21 | ||||
|
22 | from . import Interface | |||
21 |
|
23 | |||
22 | def asStructuredText(I, munge=0, rst=False): |
|
24 | def asStructuredText(I, munge=0, rst=False): | |
23 | """ Output structured text format. Note, this will whack any existing |
|
25 | """ Output structured text format. Note, this will whack any existing | |
@@ -41,7 +43,7 b' def asStructuredText(I, munge=0, rst=Fal' | |||||
41 |
|
43 | |||
42 | bases = [base |
|
44 | bases = [base | |
43 | for base in I.__bases__ |
|
45 | for base in I.__bases__ | |
44 |
if base is not |
|
46 | if base is not Interface | |
45 | ] |
|
47 | ] | |
46 | if bases: |
|
48 | if bases: | |
47 | outp(_justify_and_indent("This interface extends:", level, munge)) |
|
49 | outp(_justify_and_indent("This interface extends:", level, munge)) |
@@ -14,6 +14,8 b'' | |||||
14 | """Interface-specific exceptions |
|
14 | """Interface-specific exceptions | |
15 | """ |
|
15 | """ | |
16 |
|
16 | |||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
17 | class Invalid(Exception): |
|
19 | class Invalid(Exception): | |
18 | """A specification is violated |
|
20 | """A specification is violated | |
19 | """ |
|
21 | """ |
@@ -13,7 +13,7 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Interface object implementation |
|
14 | """Interface object implementation | |
15 | """ |
|
15 | """ | |
16 | from __future__ import generators |
|
16 | from __future__ import absolute_import, generators | |
17 |
|
17 | |||
18 | import sys |
|
18 | import sys | |
19 | from types import MethodType |
|
19 | from types import MethodType | |
@@ -21,8 +21,8 b' from types import FunctionType' | |||||
21 | import warnings |
|
21 | import warnings | |
22 | import weakref |
|
22 | import weakref | |
23 |
|
23 | |||
24 |
from |
|
24 | from .exceptions import Invalid | |
25 |
from |
|
25 | from .ro import ro | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | CO_VARARGS = 4 |
|
28 | CO_VARARGS = 4 | |
@@ -114,7 +114,7 b' class SpecificationBasePy(object):' | |||||
114 |
|
114 | |||
115 | SpecificationBase = SpecificationBasePy |
|
115 | SpecificationBase = SpecificationBasePy | |
116 | try: |
|
116 | try: | |
117 |
from |
|
117 | from ._zope_interface_coptimizations import SpecificationBase | |
118 | except ImportError: |
|
118 | except ImportError: | |
119 | pass |
|
119 | pass | |
120 |
|
120 | |||
@@ -155,14 +155,14 b' class InterfaceBasePy(object):' | |||||
155 |
|
155 | |||
156 | InterfaceBase = InterfaceBasePy |
|
156 | InterfaceBase = InterfaceBasePy | |
157 | try: |
|
157 | try: | |
158 |
from |
|
158 | from ._zope_interface_coptimizations import InterfaceBase | |
159 | except ImportError: |
|
159 | except ImportError: | |
160 | pass |
|
160 | pass | |
161 |
|
161 | |||
162 |
|
162 | |||
163 | adapter_hooks = [] |
|
163 | adapter_hooks = [] | |
164 | try: |
|
164 | try: | |
165 |
from |
|
165 | from ._zope_interface_coptimizations import adapter_hooks | |
166 | except ImportError: |
|
166 | except ImportError: | |
167 | pass |
|
167 | pass | |
168 |
|
168 | |||
@@ -665,22 +665,22 b' def fromMethod(meth, interface=None, nam' | |||||
665 |
|
665 | |||
666 | # Now we can create the interesting interfaces and wire them up: |
|
666 | # Now we can create the interesting interfaces and wire them up: | |
667 | def _wire(): |
|
667 | def _wire(): | |
668 |
from |
|
668 | from .declarations import classImplements | |
669 |
|
669 | |||
670 |
from |
|
670 | from .interfaces import IAttribute | |
671 | classImplements(Attribute, IAttribute) |
|
671 | classImplements(Attribute, IAttribute) | |
672 |
|
672 | |||
673 |
from |
|
673 | from .interfaces import IMethod | |
674 | classImplements(Method, IMethod) |
|
674 | classImplements(Method, IMethod) | |
675 |
|
675 | |||
676 |
from |
|
676 | from .interfaces import IInterface | |
677 | classImplements(InterfaceClass, IInterface) |
|
677 | classImplements(InterfaceClass, IInterface) | |
678 |
|
678 | |||
679 |
from |
|
679 | from .interfaces import ISpecification | |
680 | classImplements(Specification, ISpecification) |
|
680 | classImplements(Specification, ISpecification) | |
681 |
|
681 | |||
682 | # We import this here to deal with module dependencies. |
|
682 | # We import this here to deal with module dependencies. | |
683 |
from |
|
683 | from .declarations import implementedBy | |
684 |
from |
|
684 | from .declarations import providedBy | |
685 |
from |
|
685 | from .exceptions import InvalidInterface | |
686 |
from |
|
686 | from .exceptions import BrokenImplementation |
@@ -13,11 +13,14 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Interface Package Interfaces |
|
14 | """Interface Package Interfaces | |
15 | """ |
|
15 | """ | |
|
16 | ||||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
16 | __docformat__ = 'restructuredtext' |
|
19 | __docformat__ = 'restructuredtext' | |
17 |
|
20 | |||
18 |
from |
|
21 | from .interface import Attribute | |
19 |
from |
|
22 | from .interface import Interface | |
20 |
from |
|
23 | from .declarations import implementer | |
21 |
|
24 | |||
22 |
|
25 | |||
23 | _BLANK = u'' |
|
26 | _BLANK = u'' | |
@@ -447,10 +450,10 b' class IInterfaceDeclaration(Interface):' | |||||
447 | Instances of ``C`` provide only ``I1``, ``I2``, and regardless of |
|
450 | Instances of ``C`` provide only ``I1``, ``I2``, and regardless of | |
448 | whatever interfaces instances of ``A`` and ``B`` implement. |
|
451 | whatever interfaces instances of ``A`` and ``B`` implement. | |
449 | """ |
|
452 | """ | |
450 |
|
453 | |||
451 | def implementer_only(*interfaces): |
|
454 | def implementer_only(*interfaces): | |
452 |
"""Create a decorator for declaring the only interfaces implemented |
|
455 | """Create a decorator for declaring the only interfaces implemented | |
453 |
|
456 | |||
454 | A callable is returned that makes an implements declaration on |
|
457 | A callable is returned that makes an implements declaration on | |
455 | objects passed to it. |
|
458 | objects passed to it. | |
456 | """ |
|
459 | """ |
@@ -13,31 +13,34 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Basic components support |
|
14 | """Basic components support | |
15 | """ |
|
15 | """ | |
|
16 | ||||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
16 | from collections import defaultdict |
|
19 | from collections import defaultdict | |
17 |
|
20 | |||
18 | try: |
|
21 | try: | |
19 |
from |
|
22 | from ..event import notify | |
20 | except ImportError: # pragma: no cover |
|
23 | except ImportError: # pragma: no cover | |
21 | def notify(*arg, **kw): pass |
|
24 | def notify(*arg, **kw): pass | |
22 |
|
25 | |||
23 |
from |
|
26 | from .interfaces import ISpecification | |
24 |
from |
|
27 | from .interfaces import ComponentLookupError | |
25 |
from |
|
28 | from .interfaces import IAdapterRegistration | |
26 |
from |
|
29 | from .interfaces import IComponents | |
27 |
from |
|
30 | from .interfaces import IHandlerRegistration | |
28 |
from |
|
31 | from .interfaces import ISubscriptionAdapterRegistration | |
29 |
from |
|
32 | from .interfaces import IUtilityRegistration | |
30 |
from |
|
33 | from .interfaces import Registered | |
31 |
from |
|
34 | from .interfaces import Unregistered | |
32 |
|
35 | |||
33 |
from |
|
36 | from .interface import Interface | |
34 |
from |
|
37 | from .declarations import implementedBy | |
35 |
from |
|
38 | from .declarations import implementer | |
36 |
from |
|
39 | from .declarations import implementer_only | |
37 |
from |
|
40 | from .declarations import providedBy | |
38 |
from |
|
41 | from .adapter import AdapterRegistry | |
39 |
from |
|
42 | from ._compat import CLASS_TYPES | |
40 |
from |
|
43 | from ._compat import STRING_TYPES | |
41 |
|
44 | |||
42 |
|
45 | |||
43 | class _UnhashableComponentCounter(object): |
|
46 | class _UnhashableComponentCounter(object): |
@@ -13,6 +13,9 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Compute a resolution order for an object and its bases |
|
14 | """Compute a resolution order for an object and its bases | |
15 | """ |
|
15 | """ | |
|
16 | ||||
|
17 | from __future__ import absolute_import | |||
|
18 | ||||
16 | __docformat__ = 'restructuredtext' |
|
19 | __docformat__ = 'restructuredtext' | |
17 |
|
20 | |||
18 | def _mergeOrderings(orderings): |
|
21 | def _mergeOrderings(orderings): |
@@ -13,10 +13,12 b'' | |||||
13 | ############################################################################## |
|
13 | ############################################################################## | |
14 | """Verify interface implementations |
|
14 | """Verify interface implementations | |
15 | """ |
|
15 | """ | |
16 | from zope.interface.exceptions import BrokenImplementation, DoesNotImplement |
|
16 | from __future__ import absolute_import | |
17 | from zope.interface.exceptions import BrokenMethodImplementation |
|
17 | ||
|
18 | from .exceptions import BrokenImplementation, DoesNotImplement | |||
|
19 | from .exceptions import BrokenMethodImplementation | |||
18 | from types import FunctionType, MethodType |
|
20 | from types import FunctionType, MethodType | |
19 |
from |
|
21 | from .interface import fromMethod, fromFunction, Method | |
20 | import sys |
|
22 | import sys | |
21 |
|
23 | |||
22 | # This will be monkey-patched when running under Zope 2, so leave this |
|
24 | # This will be monkey-patched when running under Zope 2, so leave this |
General Comments 0
You need to be logged in to leave comments.
Login now