本文整理汇总了Python中pydoc.help函数的典型用法代码示例。如果您正苦于以下问题:Python help函数的具体用法?Python help怎么用?Python help使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了help函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resolve_false
def test_resolve_false(self):
# Issue #23008: pydoc enum.{,Int}Enum failed
# because bool(enum.Enum) is False.
with captured_stdout() as help_io:
pydoc.help('enum.Enum')
helptext = help_io.getvalue()
self.assertIn('class Enum', helptext)
示例2: help
def help(obj=None):
if not obj:
print """Welcome to Abrupt!
If this is your first time using Abrupt, you should check the
quickstart at http://securusglobal.github.com/abrupt/.
Here are the basic functions of Abrupt, type 'help(function)'
for a complete description of these functions:
* proxy: Start a HTTP proxy on port 8080.
* create: Create a HTTP request based on a URL.
* inject: Inject or fuzz a request.
Abrupt have few classes which worth having a look at, typing 'help(class)':
* Request
* Response
* RequestSet
There are also few interesting global objects, 'help(object)':
* conf
* history
Please, report any bug or comment to [email protected]"""
else:
pydoc.help(obj)
示例3: test_dispatch_method_class_help
def test_dispatch_method_class_help(capsys):
pydoc.help(Foo)
out, err = capsys.readouterr()
assert rstrip_lines(out) == """\
Help on class Foo in module reg.tests.fixtures.module:
class Foo({builtins}.object)
| Class for foo objects.
|
| Methods defined here:
|
| bar(self, obj)
| Return the bar of an object.
|
| baz(self, obj)
| Return the baz of an object.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
""".format(builtins=object.__module__)
示例4: help
def help(obj, visualization=False, ansi=True):
"""
Extended version of the built-in help that supports parameterized
functions and objects. If ansi is set to False, all ANSI color
codes are stripped out.
"""
ansi_escape = re.compile(r'\x1b[^m]*m')
parameterized_object = isinstance(obj, param.Parameterized)
parameterized_class = (isinstance(obj,type)
and issubclass(obj,param.Parameterized))
if parameterized_object or parameterized_class:
if Store.registry.get(obj if parameterized_class else type(obj), False):
if visualization is False:
print("\nTo view the visualization options applicable to this object or class, use:\n\n"
" holoviews.help(obj, visualization=True)\n")
else:
Store.info(obj, ansi=ansi)
return
info = param.ipython.ParamPager()(obj)
if ansi is False:
info = ansi_escape.sub('', info)
print(info)
else:
pydoc.help(obj)
示例5: usage
def usage():
if __name__ == '__main__':
import pydoc
#FIXME: literally displayed '__main__'
print pydoc.help(__name__)
else:
help(str(os.path.basename(sys.argv[0]).split('.')[0]))
示例6: output_help_to_file
def output_help_to_file(filepath, request):
f = file(filepath, 'w')
sys.stdout = f
pydoc.help(request)
f.close()
sys.stdout = sys.__stdout__
return
示例7: test_namedtuple_public_underscore
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)
示例8: output_help_to_file
def output_help_to_file(request):
filepath = request + "_package_info.txt"
f = file(filepath, 'w')
sys.stdout = f
pydoc.help(request)
f.close()
sys.stdout = sys.__stdout__
return
示例9: _help
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)
示例10: test_pydoc_gitr
def test_pydoc_gitr(capsys):
"""
Verify the behavior of running 'pydoc gitr'
"""
pytest.dbgfunc()
pydoc.help(gitr)
o, e = capsys.readouterr()
z = docopt_exp()
for k in z:
assert k in o
示例11: help
def help(self, *args, **kwargs):
"""Print Automate help if no parameter is given. Otherwise,
act as pydoc.help()"""
if len(args) > 0 or len(kwargs) > 0:
import pydoc
pydoc.help(*args, **kwargs)
else:
hstr = helpstr
for i in hstr.split("\n"):
self.logger.info(i)
return True
示例12: main
def main():
f = Foo(4)
assert(f.value2 == 8)
f.value2 = 5 # This will override value2() method
assert(f.value2 == 5)
assert(f.value3 == 4)
f.value3 = 6
assert(f.value3 == 6)
print help(Foo)
del(f.value3)
print "Success."
return 0
示例13: main
def main():
"""
Usage:
pyXPad [opt] output
Argument:
output: Base name for the output file. Image number and extension will
be append.
Ex:
#python pyXPad data/Test
#ls data/Test*
data/Test_0000.edf
Options:
-c: Load calibration files. Calibration file names are defined in
pyXPad_conf.py
-n: Number of images to be taken.
-e: Exposure time in us.
-l: Latency time in us (minimum 5000 us).
-o: Overflow counter pull period (minimum 4000 us).
-t: Trigger mode.
0: Internal trigger
1: External gate
2: External trigger for sequence
3: External trigger for singles
-a: Analog output mode.
0: Bussy
1: Bussy - Shutter time
2: Image read enabled
3: Overflow counter pull
4: Exposure
5: Reserved
6: Image transfer
7: FIFO full
8: External Gate
9: Reserved
Press "q" to exit
"""
import getopt, sys
import pydoc
import time
from EdfFile import EdfFile as EDF
try:
opts, args = getopt.getopt(sys.argv[1:], "cn:t:a:e:l:o:")
except getopt.GetoptError, err:
# print help information and exit:
pydoc.help(main)
sys.exit(2)
示例14: help
def help(*objects):
"""Print doc strings for object(s).
Usage: >>> help(object, [obj2, objN]) (brackets mean [optional] argument)
"""
if len(objects) == 0:
help(help)
return
for obj in objects:
try:
print('****', obj.__name__ , '****')
print(obj.__doc__)
except AttributeError:
print(obj, 'has no __doc__ attribute')
print()
示例15: get_help
def get_help(self, topic):
title = text = None
if topic is not None:
import pydoc
pydoc.help(topic)
rv = sys.stdout.reset().decode('utf-8', 'ignore')
paragraphs = _paragraph_re.split(rv)
if len(paragraphs) > 1:
title = paragraphs[0]
text = '\n\n'.join(paragraphs[1:])
else:
title = 'Help'
text = paragraphs[0]
return render_template('help_command.html', title=title, text=text)