当前位置: 首页>>代码示例>>Python>>正文


Python pydoc.pipepager方法代码示例

本文整理汇总了Python中pydoc.pipepager方法的典型用法代码示例。如果您正苦于以下问题:Python pydoc.pipepager方法的具体用法?Python pydoc.pipepager怎么用?Python pydoc.pipepager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pydoc的用法示例。


在下文中一共展示了pydoc.pipepager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: page_string

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pipepager [as 别名]
def page_string(str_to_page, pager_cmd):
    """
    Page str_to_page via the pager.
    """
    # By default, we expect the command to be `less -R`. If that is the
    # pager_cmd, but they don't have less on their machine, odds are they're
    # just using the default value. In this case the pager will fail, so we'll
    # just go via pydoc.pager, which tries to do smarter checking that we don't
    # want to bother trying to replicate.
    use_fallback_page_function = False
    if pager_cmd is None:
        use_fallback_page_function = True
    elif pager_cmd == FLAG_FALLBACK:
        use_fallback_page_function = True

    try:
        if use_fallback_page_function:
            pydoc.pager(str_to_page)
        else:
            # Otherwise, obey the user.
            pydoc.pipepager(str_to_page, cmd=pager_cmd)
    except KeyboardInterrupt:
        pass 
开发者ID:srsudar,项目名称:eg,代码行数:25,代码来源:util.py

示例2: test_pipepager

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pipepager [as 别名]
def test_pipepager(self):
        # pipepager does not choke on unicode
        doc = pydoc.render_doc(self.Q)

        saved, os.popen = os.popen, open
        try:
            with test.test_support.temp_cwd():
                pydoc.pipepager(doc, 'pipe')
                self.assertEqual(open('pipe').read(), pydoc._encode(doc))
        finally:
            os.popen = saved 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_pydoc.py

示例3: _pageDoc

# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import pipepager [as 别名]
def _pageDoc(title, docString):
    docString = _formatDocString(docString)
    # pydoc is fooled by conary's wrapping of stdout. override it if needed.
    if sys.stdout.isatty():
        if _useLess():
            # -R parses CSR escape codes properly
            pydoc.pager = lambda x: pydoc.pipepager(x, 'less -R')
        else:
            # PAGER is set if _useLess returns False
            pydoc.pager = lambda x: pydoc.pipepager(x, os.environ['PAGER'])
    pydoc.pager("Conary API Documentation: %s\n" %
            _formatString('B{' + title + '}') + docString) 
开发者ID:sassoftware,项目名称:conary,代码行数:14,代码来源:explain.py


注:本文中的pydoc.pipepager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。