diff mercurial/thirdparty/zope/interface/interface.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 7862a5ac35cf
line wrap: on
line diff
--- a/mercurial/thirdparty/zope/interface/interface.py	Wed Mar 21 19:49:07 2018 -0700
+++ b/mercurial/thirdparty/zope/interface/interface.py	Wed Mar 21 19:52:30 2018 -0700
@@ -13,7 +13,7 @@
 ##############################################################################
 """Interface object implementation
 """
-from __future__ import generators
+from __future__ import absolute_import, generators
 
 import sys
 from types import MethodType
@@ -21,8 +21,8 @@
 import warnings
 import weakref
 
-from zope.interface.exceptions import Invalid
-from zope.interface.ro import ro
+from .exceptions import Invalid
+from .ro import ro
 
 
 CO_VARARGS = 4
@@ -114,7 +114,7 @@
 
 SpecificationBase = SpecificationBasePy
 try:
-    from zope.interface._zope_interface_coptimizations import SpecificationBase
+    from ._zope_interface_coptimizations import SpecificationBase
 except ImportError:
     pass
 
@@ -155,14 +155,14 @@
 
 InterfaceBase = InterfaceBasePy
 try:
-    from zope.interface._zope_interface_coptimizations import InterfaceBase
+    from ._zope_interface_coptimizations import InterfaceBase
 except ImportError:
     pass
 
 
 adapter_hooks = []
 try:
-    from zope.interface._zope_interface_coptimizations import adapter_hooks
+    from ._zope_interface_coptimizations import adapter_hooks
 except ImportError:
     pass
 
@@ -665,22 +665,22 @@
 
 # Now we can create the interesting interfaces and wire them up:
 def _wire():
-    from zope.interface.declarations import classImplements
+    from .declarations import classImplements
 
-    from zope.interface.interfaces import IAttribute
+    from .interfaces import IAttribute
     classImplements(Attribute, IAttribute)
 
-    from zope.interface.interfaces import IMethod
+    from .interfaces import IMethod
     classImplements(Method, IMethod)
 
-    from zope.interface.interfaces import IInterface
+    from .interfaces import IInterface
     classImplements(InterfaceClass, IInterface)
 
-    from zope.interface.interfaces import ISpecification
+    from .interfaces import ISpecification
     classImplements(Specification, ISpecification)
 
 # We import this here to deal with module dependencies.
-from zope.interface.declarations import implementedBy
-from zope.interface.declarations import providedBy
-from zope.interface.exceptions import InvalidInterface
-from zope.interface.exceptions import BrokenImplementation
+from .declarations import implementedBy
+from .declarations import providedBy
+from .exceptions import InvalidInterface
+from .exceptions import BrokenImplementation