comparison mercurial/thirdparty/zope/interface/document.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
14 """ Pretty-Print an Interface object as structured text (Yum) 14 """ Pretty-Print an Interface object as structured text (Yum)
15 15
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
24 'structured' format of the text. 26 'structured' format of the text.
25 27
39 if I.getDoc(): 41 if I.getDoc():
40 outp(_justify_and_indent(_trim_doc_string(I.getDoc()), level)) 42 outp(_justify_and_indent(_trim_doc_string(I.getDoc()), level))
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 zope.interface.Interface 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))
48 level += 1 50 level += 1
49 for b in bases: 51 for b in bases: