當前位置: 首頁>>代碼示例>>Python>>正文


Python pydoc.plainpager方法代碼示例

本文整理匯總了Python中pydoc.plainpager方法的典型用法代碼示例。如果您正苦於以下問題:Python pydoc.plainpager方法的具體用法?Python pydoc.plainpager怎麽用?Python pydoc.plainpager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pydoc的用法示例。


在下文中一共展示了pydoc.plainpager方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_plainpager

# 需要導入模塊: import pydoc [as 別名]
# 或者: from pydoc import plainpager [as 別名]
def test_plainpager(self):
        # plainpager does not choke on unicode
        doc = pydoc.render_doc(self.Q)

        # Note: captured_stdout is too permissive when it comes to
        # unicode, and using it here would make the test always
        # pass.
        with test.test_support.temp_cwd():
            with open('output', 'w') as f:
                saved, sys.stdout = sys.stdout, f
                try:
                    pydoc.plainpager(doc)
                finally:
                    sys.stdout = saved
            self.assertIn('Rational numbers:', open('output').read()) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:17,代碼來源:test_pydoc.py

示例2: replace_help

# 需要導入模塊: import pydoc [as 別名]
# 或者: from pydoc import plainpager [as 別名]
def replace_help(namespace):
    def _help(*args):
        # because of how the console works. we need our own help() pager func.
        # replace the bold function because it adds crazy chars
        import pydoc
        pydoc.getpager = lambda: pydoc.plainpager
        pydoc.Helper.getline = lambda self, prompt: None
        pydoc.TextDoc.use_bold = lambda self, text: text

        pydoc.help(*args)

    namespace["help"] = _help 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:14,代碼來源:console_python.py

示例3: __init__

# 需要導入模塊: import pydoc [as 別名]
# 或者: from pydoc import plainpager [as 別名]
def __init__(self):
        global _vm
        _vm = self

        self._ini = None
        self._command_handlers = {}
        self._object_info_tweakers = []
        self._import_handlers = {}
        self._input_queue = queue.Queue()
        self._source_preprocessors = []
        self._ast_postprocessors = []
        self._main_dir = os.path.dirname(sys.modules["thonny"].__file__)
        self._heap = {}  # WeakValueDictionary would be better, but can't store reference to None
        self._source_info_by_frame = {}
        site.sethelper()  # otherwise help function is not available
        pydoc.pager = pydoc.plainpager  # otherwise help command plays tricks
        self._install_fake_streams()
        self._install_repl_helper()
        self._current_executor = None
        self._io_level = 0
        self._tty_mode = True
        self._tcl = None

        # clean up path
        sys.path = [d for d in sys.path if d != ""]

        # start in shell mode
        sys.argv[:] = [""]  # empty "script name"
        sys.path.insert(0, "")  # current dir

        # clean __main__ global scope
        for key in list(__main__.__dict__.keys()):
            if not key.startswith("__") or key in {"__file__", "__cached__"}:
                del __main__.__dict__[key]

        # unset __doc__, then exec dares to write doc of the script there
        __main__.__doc__ = None

        if "THONNY_FRONTEND_SYS_PATH" in os.environ:
            self._frontend_sys_path = ast.literal_eval(os.environ["THONNY_FRONTEND_SYS_PATH"])
        else:
            self._frontend_sys_path = []
        self._load_shared_modules()
        self._load_plugins()

        self._install_signal_handler() 
開發者ID:thonny,項目名稱:thonny,代碼行數:48,代碼來源:backend.py


注:本文中的pydoc.plainpager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。