当前位置: 首页>>代码示例>>Python>>正文


Python pydoc.help函数代码示例

本文整理汇总了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)
开发者ID:Martiusweb,项目名称:cpython,代码行数:7,代码来源:test_pydoc.py

示例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)
开发者ID:lukejahnke,项目名称:abrupt,代码行数:25,代码来源:console.py

示例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__)
开发者ID:morepath,项目名称:reg,代码行数:26,代码来源:test_docgen.py

示例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)
开发者ID:richwu,项目名称:holoviews,代码行数:25,代码来源:__init__.py

示例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]))
开发者ID:ArnoCan,项目名称:epyunit,代码行数:7,代码来源:setup.py

示例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
开发者ID:dirk2011,项目名称:mymc_git,代码行数:7,代码来源:generate_helpdocs.py

示例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)
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:8,代码来源:test_pydoc.py

示例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
开发者ID:merakee,项目名称:NLP_Code,代码行数:8,代码来源:get_package_info.py

示例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)
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:9,代码来源:console_python.py

示例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
开发者ID:tbarron,项目名称:gitr,代码行数:10,代码来源:test_gitr.py

示例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
开发者ID:tuomas2,项目名称:automate,代码行数:12,代码来源:textui.py

示例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
开发者ID:von,项目名称:sandbox,代码行数:12,代码来源:property.py

示例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)
开发者ID:gjover,项目名称:Lima-camera-xpad,代码行数:52,代码来源:Communication.py

示例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()
开发者ID:peplin,项目名称:python-startup,代码行数:14,代码来源:startup.py

示例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)
开发者ID:danaspiegel,项目名称:softball_stat_manager,代码行数:14,代码来源:repr.py


注:本文中的pydoc.help函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。