當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。