Python pydoc.help() Examples
The following are 30
code examples of pydoc.help().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pydoc
, or try the search function
.
Example #1
Source File: repr.py From recruit with Apache License 2.0 | 6 votes |
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})
Example #2
Source File: repr.py From jbox with MIT License | 6 votes |
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)
Example #3
Source File: repr.py From jbox with MIT License | 6 votes |
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})
Example #4
Source File: repr.py From recruit with Apache License 2.0 | 6 votes |
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)
Example #5
Source File: repr.py From lambda-packs with MIT License | 6 votes |
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})
Example #6
Source File: repr.py From lambda-packs with MIT License | 6 votes |
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)
Example #7
Source File: repr.py From scylla with Apache License 2.0 | 6 votes |
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)
Example #8
Source File: repr.py From scylla with Apache License 2.0 | 6 votes |
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})
Example #9
Source File: repr.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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})
Example #10
Source File: repr.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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)
Example #11
Source File: repr.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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})
Example #12
Source File: repr.py From RSSNewsGAE with Apache License 2.0 | 6 votes |
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})
Example #13
Source File: repr.py From RSSNewsGAE with Apache License 2.0 | 6 votes |
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)
Example #14
Source File: site.py From build-calibre with GNU General Public License v3.0 | 5 votes |
def set_helper(): __builtin__.help = _Helper()
Example #15
Source File: site.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def __repr__(self): return "Type help() for interactive help, " \ "or help(object) for help about object."
Example #16
Source File: site.py From telegram-robot-rss with Mozilla Public License 2.0 | 5 votes |
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
Example #17
Source File: test_pydoc.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_help_output_redirect(self): # issue 940286, if output is set in Helper, then all output from # Helper.help should be redirected old_pattern = expected_text_pattern getpager_old = pydoc.getpager getpager_new = lambda: (lambda x: x) self.maxDiff = None buf = StringIO() helper = pydoc.Helper(output=buf) unused, doc_loc = get_pydoc_text(pydoc_mod) module = "test.pydoc_mod" help_header = """ Help on module test.pydoc_mod in test: """.lstrip() help_header = textwrap.dedent(help_header) expected_help_pattern = help_header + expected_text_pattern pydoc.getpager = getpager_new try: with captured_output('stdout') as output, \ captured_output('stderr') as err: helper.help(module) result = buf.getvalue().strip() expected_text = expected_help_pattern % ( (doc_loc,) + expected_text_data_docstrings + (inspect.getabsfile(pydoc_mod),)) self.assertEqual('', output.getvalue()) self.assertEqual('', err.getvalue()) self.assertEqual(expected_text, result) finally: pydoc.getpager = getpager_old
Example #18
Source File: _sitebuiltins.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
Example #19
Source File: _sitebuiltins.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __repr__(self): return "Type help() for interactive help, " \ "or help(object) for help about object."
Example #20
Source File: site.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def sethelper(): builtins.help = _Helper()
Example #21
Source File: site.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
Example #22
Source File: site.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def __repr__(self): return "Type help() for interactive help, " \ "or help(object) for help about object."
Example #23
Source File: keywords.py From NukeToolSet with MIT License | 5 votes |
def imitate_pydoc(string): """ It's not possible to get the pydoc's without starting the annoying pager stuff. """ # str needed because of possible unicode stuff in py2k (pydoc doesn't work # with unicode strings) string = str(string) h = pydoc.help with common.ignored(KeyError): # try to access symbols string = h.symbols[string] string, _, related = string.partition(' ') get_target = lambda s: h.topics.get(s, h.keywords.get(s)) while isinstance(string, str): string = get_target(string) try: # is a tuple now label, related = string except TypeError: return '' try: return pydoc_topics.topics[label] if pydoc_topics else '' except KeyError: return ''
Example #24
Source File: site.py From pmatic with GNU General Public License v2.0 | 5 votes |
def sethelper(): __builtin__.help = _Helper()
Example #25
Source File: site.py From pmatic with GNU General Public License v2.0 | 5 votes |
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
Example #26
Source File: site.py From pmatic with GNU General Public License v2.0 | 5 votes |
def __repr__(self): return "Type help() for interactive help, " \ "or help(object) for help about object."
Example #27
Source File: site.py From deepWordBug with Apache License 2.0 | 5 votes |
def sethelper(): builtins.help = _Helper()
Example #28
Source File: site.py From deepWordBug with Apache License 2.0 | 5 votes |
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
Example #29
Source File: site.py From deepWordBug with Apache License 2.0 | 5 votes |
def __repr__(self): return "Type help() for interactive help, " "or help(object) for help about object."
Example #30
Source File: test_pydoc.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
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)