Mercurial > public > mercurial-scm > hg
comparison mercurial/thirdparty/zope/interface/interfaces.py @ 37178:68ee61822182
thirdparty: port zope.interface to relative imports
By using relative imports, we're guaranteed to get modules
vendored with Mercurial rather than other random modules
that might be in sys.path.
My editor strips trailing whitespace on save. So some minor
source code cleanup was also performed as part of this commit.
# no-check-commit because some modified lines have double newlines
Differential Revision: https://phab.mercurial-scm.org/D2930
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 21 Mar 2018 19:52:30 -0700 |
parents | 943d77fc07a3 |
children |
comparison
equal
deleted
inserted
replaced
37177:338367d44d34 | 37178:68ee61822182 |
---|---|
11 # FOR A PARTICULAR PURPOSE. | 11 # FOR A PARTICULAR PURPOSE. |
12 # | 12 # |
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 zope.interface.interface import Attribute | 21 from .interface import Attribute |
19 from zope.interface.interface import Interface | 22 from .interface import Interface |
20 from zope.interface.declarations import implementer | 23 from .declarations import implementer |
21 | 24 |
22 | 25 |
23 _BLANK = u'' | 26 _BLANK = u'' |
24 | 27 |
25 class IElement(Interface): | 28 class IElement(Interface): |
445 classImplementsOnly(C. I1, I2) | 448 classImplementsOnly(C. I1, I2) |
446 | 449 |
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 """ |
457 | 460 |
458 def directlyProvidedBy(object): | 461 def directlyProvidedBy(object): |