本文整理汇总了Python中pydoc.help方法的典型用法代码示例。如果您正苦于以下问题:Python pydoc.help方法的具体用法?Python pydoc.help怎么用?Python pydoc.help使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pydoc
的用法示例。
在下文中一共展示了pydoc.help方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __call__(self, topic=None):
if topic is None:
sys.stdout._write("<span class=help>%s</span>" % repr(self))
return
import pydoc
pydoc.help(topic)
rv = sys.stdout.reset()
if isinstance(rv, bytes):
rv = rv.decode("utf-8", "ignore")
paragraphs = _paragraph_re.split(rv)
if len(paragraphs) > 1:
title = paragraphs[0]
text = "\n\n".join(paragraphs[1:])
else: # pragma: no cover
title = "Help"
text = paragraphs[0]
sys.stdout._write(HELP_HTML % {"title": title, "text": text})
示例2: dispatch_repr
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def dispatch_repr(self, obj, recursive):
if obj is helper:
return u'<span class="help">%r</span>' % helper
if isinstance(obj, (integer_types, float, complex)):
return u'<span class="number">%r</span>' % obj
if isinstance(obj, string_types) or isinstance(obj, bytes):
return self.string_repr(obj)
if isinstance(obj, RegexType):
return self.regex_repr(obj)
if isinstance(obj, list):
return self.list_repr(obj, recursive)
if isinstance(obj, tuple):
return self.tuple_repr(obj, recursive)
if isinstance(obj, set):
return self.set_repr(obj, recursive)
if isinstance(obj, frozenset):
return self.frozenset_repr(obj, recursive)
if isinstance(obj, dict):
return self.dict_repr(obj, recursive)
if deque is not None and isinstance(obj, deque):
return self.deque_repr(obj, recursive)
return self.object_repr(obj)
示例3: __call__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __call__(self, topic=None):
if topic is None:
sys.stdout._write('<span class=help>%s</span>' % repr(self))
return
import pydoc
pydoc.help(topic)
rv = sys.stdout.reset()
if isinstance(rv, bytes):
rv = rv.decode('utf-8', 'ignore')
paragraphs = _paragraph_re.split(rv)
if len(paragraphs) > 1:
title = paragraphs[0]
text = '\n\n'.join(paragraphs[1:])
else: # pragma: no cover
title = 'Help'
text = paragraphs[0]
sys.stdout._write(HELP_HTML % {'title': title, 'text': text})
示例4: dispatch_repr
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def dispatch_repr(self, obj, recursive):
if obj is helper:
return u'<span class="help">%r</span>' % helper
if isinstance(obj, (integer_types, float, complex)):
return u'<span class="number">%r</span>' % obj
if isinstance(obj, string_types):
return self.string_repr(obj)
if isinstance(obj, RegexType):
return self.regex_repr(obj)
if isinstance(obj, list):
return self.list_repr(obj, recursive)
if isinstance(obj, tuple):
return self.tuple_repr(obj, recursive)
if isinstance(obj, set):
return self.set_repr(obj, recursive)
if isinstance(obj, frozenset):
return self.frozenset_repr(obj, recursive)
if isinstance(obj, dict):
return self.dict_repr(obj, recursive)
if deque is not None and isinstance(obj, deque):
return self.deque_repr(obj, recursive)
return self.object_repr(obj)
示例5: __repr__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __repr__(self):
return "Type help(object) for help about object."
示例6: __repr__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __repr__(self):
return 'Type help(object) for help about object.'
示例7: __repr__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __repr__(self):
return "Type help() for interactive help, " \
"or help(object) for help about object."
示例8: __call__
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def __call__(self, *args, **kwds):
import pydoc
return pydoc.help(*args, **kwds)
示例9: sethelper
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def sethelper():
__builtin__.help = _Helper()
示例10: test_namedtuple_public_underscore
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def test_namedtuple_public_underscore(self):
NT = namedtuple('NT', ['abc', 'def'], rename=True)
with captured_stdout() as help_io:
pydoc.help(NT)
helptext = help_io.getvalue()
self.assertIn('_1', helptext)
self.assertIn('_replace', helptext)
self.assertIn('_asdict', helptext)
示例11: sethelper
# 需要导入模块: import pydoc [as 别名]
# 或者: from pydoc import help [as 别名]
def sethelper():
builtins.help = _Helper()