python类writedoc()的实例源码

test_pydoc.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def test_htmlpage(self):
        # html.page does not choke on unicode
        with test.test_support.temp_cwd():
            with captured_stdout() as output:
                pydoc.writedoc(self.Q)
        self.assertEqual(output.getvalue(), 'wrote Q.html\n')
test_pydoc.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_htmlpage(self):
        # html.page does not choke on unicode
        with test.test_support.temp_cwd():
            with captured_stdout() as output:
                pydoc.writedoc(self.Q)
        self.assertEqual(output.getvalue(), 'wrote Q.html\n')
test_pydoc.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_htmlpage(self):
        # html.page does not choke on unicode
        with test.test_support.temp_cwd():
            with captured_stdout() as output:
                pydoc.writedoc(self.Q)
        self.assertEqual(output.getvalue(), 'wrote Q.html\n')
install.py 文件源码 项目:w4py 作者: Cito 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def createPyDocs(self, filename, dir):
        """Create an HTML module documentation using pydoc."""
        import pydoc
        package, module = os.path.split(filename)
        module = os.path.splitext(module)[0]
        if package:
            module = package.replace('/', '.') + '.' + module
        targetName = '%s/%s.html' % (dir, module)
        self.printMsg('Creating %s...' % targetName)
        saveDir = os.getcwd()
        os.chdir(dir)
        try:
            stdout = sys.stdout
            sys.stdout = StringIO()
            try:
                try:
                    pydoc.writedoc(module)
                except Exception:
                    pass
                msg = sys.stdout.getvalue()
            finally:
                sys.stdout = stdout
        finally:
            os.chdir(saveDir)
        if msg:
            self.printMsg(msg)


问题


面经


文章

微信
公众号

扫码关注公众号