Python pydoc 模块,writedoc() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用pydoc.writedoc()

项目:oil    作者:oilshell    | 项目源码 | 文件源码
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')
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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')
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
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')
项目:w4py    作者:Cito    | 项目源码 | 文件源码
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)