本文整理汇总了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())
示例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
示例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()