• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pydoc.render_doc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pydoc.render_doc函数的典型用法代码示例。如果您正苦于以下问题:Python render_doc函数的具体用法?Python render_doc怎么用?Python render_doc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了render_doc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: helphtml

def helphtml(obj,*aos):
	txt=''
	import pydoc,re
	if aos:
		aos=flat(obj,aos,noNone=True)
		for i in aos:
			#TODO
			txt+=re.sub('.\b', '', pydoc.render_doc(i,'%s'))
			txt+='\n==============%s=======================\n'%ct(aos)
	else:txt=re.sub('.\b', '', pydoc.render_doc(obj,'%s'))
	# txt=txt.replace(txthtml[1],txthtml[1][:1]+'!!!qgb-padding!!!'+txthtml[1][1:])
	# txt=txthtml[0]+txt+txthtml[1]
	# msgbox(txt[txt.find(b'\x08'):])
	# repl()
	# exit()
	file='Uhelp_obj.txt'
	try:
		import T
		if obj:file=T.filename(getObjName(obj))+'.txt'
		elif aos:file=T.filename(getObjName(aos[0]))+'..%s.txt'%len(aos)
	except:pass
	

	with open(file,'w') as f:
		f.write(txt)
	# write(file,txt)
	globals()['browser'](file)
开发者ID:QGB,项目名称:QPSU,代码行数:27,代码来源:U.py


示例2: handle_input

 def handle_input(self, inpt):
     if inpt == 'enter':
         return self.accept_input()
     elif inpt == 'ctrl d':
         raise urwid.ExitMainLoop()
     elif inpt == 'ctrl p':
         self.screen.page(pydoc.render_doc('pydoc'))
         return True
     elif inpt == 'ctrl o':
         txt = self.widget.inputbox.text.strip()
         try:
             fulltxt = pydoc.render_doc(str(txt))
         except ImportError:
             fulltxt = 'No documentation found for ' + repr(txt)
         self.screen.page(fulltxt)
         return True
     if inpt == 'ctrl w': # widget switch
         if self.widget.upperbox.widget == self.widget.completionbox:
             self.widget.upperbox.widget = urwid.Text(self.usagetext)
         else:
             self.widget.upperbox.widget = self.widget.completionbox
             #self.widget.upperbox.widget = urwid.Text('Another widget!')
         return True
     else:
         self.widget.upperbox.widget = urwid.Text(inpt)
         return True
开发者ID:wackywendell,项目名称:ipyurwid,代码行数:26,代码来源:fakeinterp.py


示例3: main

def main():
    try:
        action = getattr(sys.modules[__name__], sys.argv[1])
        action(*sys.argv[2:])
    except IndexError as error:
        print "Usage {0} function [args]".format(sys.argv[0])
        print pydoc.render_doc(sys.modules[__name__], "Help on %s")
开发者ID:pdxjohnny,项目名称:qson,代码行数:7,代码来源:__main__.py


示例4: help

def help(which=None):
    ''' help about all functions or one specific function '''
    m = sys.modules[__name__]
    if which:
        print (pydoc.render_doc(getattr(m, which)))
    else:
        print (pydoc.render_doc(m))
    sys.exit(1)
开发者ID:wuxxin,项目名称:salt-shared,代码行数:8,代码来源:gpgutils.py


示例5: test_non_str_name

 def test_non_str_name(self):
     # issue14638
     # Treat illegal (non-str) name like no name
     class A:
         __name__ = 42
     class B:
         pass
     adoc = pydoc.render_doc(A())
     bdoc = pydoc.render_doc(B())
     self.assertEqual(adoc.replace("A", "B"), bdoc)
开发者ID:49476291,项目名称:android-plus-plus,代码行数:10,代码来源:test_pydoc.py


示例6: test_typing_pydoc

 def test_typing_pydoc(self):
     def foo(data: typing.List[typing.Any],
             x: int) -> typing.Iterator[typing.Tuple[int, typing.Any]]:
         ...
     T = typing.TypeVar('T')
     class C(typing.Generic[T], typing.Mapping[int, str]): ...
     self.assertEqual(pydoc.render_doc(foo).splitlines()[-1],
                      'f\x08fo\x08oo\x08o(data:List[Any], x:int)'
                      ' -> Iterator[Tuple[int, Any]]')
     self.assertEqual(pydoc.render_doc(C).splitlines()[2],
                      'class C\x08C(typing.Mapping)')
开发者ID:3lnc,项目名称:cpython,代码行数:11,代码来源:test_pydoc.py


示例7: connected_all_devices

def connected_all_devices():
    print(pydoc.plain(pydoc.render_doc(topology.mount)))
    unmounted_list = topology.unmounted_nodes()
    if unmounted_list:
        for device_name in unmounted_list:
            mount_device(device_name)
#            time.sleep(15)
    else:
        print('There are no (configured) devices unmounted.')
    print(pydoc.plain(pydoc.render_doc(topology.connected)))
    print('connected:  ', topology.connected_nodes())
开发者ID:CiscoDevNet,项目名称:opendaylight-bootcamps,代码行数:11,代码来源:connect_all_devices.py


示例8: test_field_order_for_named_tuples

    def test_field_order_for_named_tuples(self):
        Person = namedtuple('Person', ['nickname', 'firstname', 'agegroup'])
        s = pydoc.render_doc(Person)
        self.assertLess(s.index('nickname'), s.index('firstname'))
        self.assertLess(s.index('firstname'), s.index('agegroup'))

        class NonIterableFields:
            _fields = None

        class NonHashableFields:
            _fields = [[]]

        # Make sure these doesn't fail
        pydoc.render_doc(NonIterableFields)
        pydoc.render_doc(NonHashableFields)
开发者ID:AndreLouisCaron,项目名称:cpython,代码行数:15,代码来源:test_pydoc.py


示例9: print_desc

def print_desc(prefix, pkg_path):
    for pkg in pu.iter_modules(pkg_path):
        name = prefix+"."+pkg[1]

        if (pkg[2] == True):
            try:
                print(pd.plain(pd.render_doc(name)))
                docstr = pd.plain(pd.render_doc(name))
                docstr = clean(docstr)
                start = docstr.find("DESCRIPTION")
                docstr = docstr[start: start + 140]
                print(name, docstr)
            except:
                print("UnexpectedError", sys.exc_info()[0])
                continue
开发者ID:nehaavishwa,项目名称:DataWrangle,代码行数:15,代码来源:NumpyPkg.py


示例10: print_doc

def print_doc (symbol):
  import pydoc;
  # if symbol is "module.symbol", try auto-import
  match_module = _re_mod_command.match(symbol);
  if match_module:
    _autoimport(match_module.group(1));
  # try to evaluate the symbol to 'what'
  what = None
  try:
    what = eval(symbol,Pyxis.Context);
  except:
    # if symbol does not contain a dot, try to treat it as a module name
    if '.' not in symbol:
      try:
        _autoimport(symbol)
        what = eval(symbol,Pyxis.Context)
      except:
        pass
  if what is None:
    print("Pyxis doesn't know anything about '%s'"%symbol);
    return;
  docs = pydoc.render_doc(what).split("\n");
  if docs[0].startswith("Python Library"):
    docs[0] = "Pyxis documentation for %s (%s):"%(symbol, type(what).__name__);
  print("\n".join(docs));
开发者ID:ska-sa,项目名称:pyxis,代码行数:25,代码来源:Internals.py


示例11: main

def main():
    print(pydoc.plain(pydoc.render_doc(topology.mount)))
    try:
        device_name = topology.unmounted_nodes()[0]
        mount_device(device_name)
    except IndexError:
        print('All configured devices are mounted. Demonstration cancelled.')
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:7,代码来源:mount.py


示例12: print_function

def print_function(functions, function):
    func = get_function(functions, function)
    if func:
        print pydoc.plain(pydoc.render_doc(
            func,
            "Displaying docstring for %s")
        )
开发者ID:vascop,项目名称:runp,代码行数:7,代码来源:runp.py


示例13: __init__

 def __init__(self, name):
     self['data'] = MyDocFileDataDict('')
     self['func'] = MyDocFileFunctionDict('')
     self['class'] = MyDocFileClassDict('')
     self['desc'] = MyDocFileDataDesc('')
     self['tree'] = ''
     self['name'] = name
     self['raw'] = re.sub('.\b', '', pydoc.render_doc(name))
     self['synmols'] = __import__(name,fromlist=[name.split('.')[-1]])
     d = split_sections(self['raw'].split('\n'))
     if 'DATA' in d.keys():
         self['data'] = MyDocFileDataDict('\n'.join(d['DATA']))
     if 'FUNCTIONS' in d.keys():
         self['func'] = MyDocFileFunctionDict('\n'.join(d['FUNCTIONS']))
     if 'CLASSES' in d.keys():
         for x in do_undent(d['CLASSES']):
             if re.match(r'[ ]*class ', x):
                 break
             self['tree'] += x + '\n'
         self['tree'] = self['tree'].rstrip()
         self['class'] = MyDocFileClassDict('\n'.join(d['CLASSES']))
     if 'DESCRIPTION' in d.keys():
         self['desc'] = MyDocFileDataDesc('\n'.join(d['DESCRIPTION']))
         self['name1'] = d['NAME'][0].strip()
     else:
         x = d['NAME'][0].split('-', 1)
         self['name1'] = x[0].strip()
         self['desc'] = MyDocFileDataDesc(x[1].strip())
     self['desc'] = MyDocFileDataDesc(self['synmols'].__doc__)
     ## print name, repr(self['synmols'].__doc__)
     self['file'] = d['FILE'][0].strip()
开发者ID:guziy,项目名称:python-rpn,代码行数:31,代码来源:pydoc2wiki.py


示例14: test_classic_class

 def test_classic_class(self):
     class C: "Classic class"
     c = C()
     self.assertEqual(pydoc.describe(C), 'class C')
     self.assertEqual(pydoc.describe(c), 'instance of C')
     expected = 'instance of C in module %s' % __name__
     self.assertIn(expected, pydoc.render_doc(c))
开发者ID:49476291,项目名称:android-plus-plus,代码行数:7,代码来源:test_pydoc.py


示例15: usage

def usage():
    usage_text = '''
    This script is a barebones version of query_cqadupstack.py which can be downloaded from https://github.com/D1Doris/CQADupStack/.

    It is called from insertrecords.cgi (see https://github.com/D1Doris/AnnotateCQADupStack), to fill a database with
    posts from CQADupStack, the StackExchange data which can be downloaded from http://nlp.cis.unimelb.edu.au/resources/cqadupstack/,
    so they can be annotated.

    The script contains a main function called load_subforum(). It has one argument: a StackExchange (CQADupStack) subforum.zip file.
    load_subforum() uses this file to create a 'Subforum' object and returns this.

    Subforum objects can be queried using the following methods:

'''

    strhelp = pydoc.render_doc(Subforum, "Help on %s")
    i = strhelp.find('below')
    strhelp = strhelp[i+9:]
    usage_text += strhelp
    usage_text += '\n\n    -----------------------------'
    usage_text += '\n\n    Here are some examples of how to use the script:'
    usage_text += '''\n\n    >>> import query_cqadupstack_barebones as qcqa
    >>> o = qcqa.load_subforum('/home/hoogeveen/datasets/CQADupStack/webmasters.zip')
    >>> o.get_posttitle('18957')
    u'What do you consider a "mobile" device?'
    >>> o.get_postbody('18957')'''
    usage_text += u'<p>I\'m implementing a mobile-friendly version of our corporate web site and will be using <a href="http://wurfl.sourceforge.net/" rel="nofollow" title="WURFL">WURFL</a> to detect mobile browsers and redirect them to our mobile site.  Having recently purchased an Android tablet, I\'ve found that many sites consider it to be a mobile device even though it has a large 10" screen and it\'s perfectly capable of handling sites designed using standard desktop resolutions.</p>\n\n<p>My plan is to use WURFL, examine the device capabilities and treat anything with a resolution width of less than 700px as a mobile device, but I\'d like some input as to that sweet spot for determining mobile vs desktop.</p>\n'
    usage_text += '\n\n    -----------------------------'
    usage_text += '\n\n    Please see the README file that came with this script for more information on the data.\n'
    print usage_text 
    sys.exit(' ')
开发者ID:D1Doris,项目名称:AnnotateCQADupStack,代码行数:31,代码来源:query_cqadupstack_barebones.py


示例16: test_builtin

    def test_builtin(self):
        for name in ('str', 'str.translate', '__builtin__.str',
                     '__builtin__.str.translate'):
            # test low-level function
            self.assertIsNotNone(pydoc.locate(name))
            # test high-level function
            try:
                pydoc.render_doc(name)
            except ImportError:
                self.fail('finding the doc of {!r} failed'.format(o))

        for name in ('not__builtin__', 'strrr', 'strr.translate',
                     'str.trrrranslate', '__builtin__.strrr',
                     '__builtin__.str.trrranslate'):
            self.assertIsNone(pydoc.locate(name))
            self.assertRaises(ImportError, pydoc.render_doc, name)
开发者ID:49476291,项目名称:android-plus-plus,代码行数:16,代码来源:test_pydoc.py


示例17: test_classic_class

 def test_classic_class(self):
     class C: "Classic class"
     c = C()
     self.assertEqual(pydoc.describe(C), 'class C')
     self.assertEqual(pydoc.describe(c), 'C')
     expected = 'C in module %s' % __name__
     self.assertTrue(expected in pydoc.render_doc(c))
开发者ID:Kanma,项目名称:Athena-Dependencies-Python,代码行数:7,代码来源:test_pydoc.py


示例18: get_help_on

    def get_help_on(self, info, level=0, none_on_fail=False):
        """Implement basic help for functions"""
        if not info['code']:
            return None if none_on_fail else ''

        last = info['obj']

        default = None if none_on_fail else ('No help available for "%s"' % last)

        parts = last.split('.')

        obj = self.env.get(parts[0], None)

        if not obj:
            return default

        for p in parts[1:]:

            obj = getattr(obj, p, None)

            if not obj:
                return default

        strhelp = pydoc.render_doc(obj, "Help on %s")
        if level == 0:
            return getattr(obj, '__doc__', strhelp)
        else:
            return strhelp
开发者ID:Calysto,项目名称:metakernel,代码行数:28,代码来源:python_magic.py


示例19: main

def main():
    print(pydoc.plain(pydoc.render_doc(topology.mount)))
    mounted_list = topology.mounted_nodes()
    if mounted_list:
        for device_name in mounted_list:
            dismount_device(device_name)
    else:
        print('There are no mounted devices to dismount.')
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:8,代码来源:dismount.py


示例20: test_class

    def test_class(self):
        class C(object): "New-style class"
        c = C()

        self.assertEqual(pydoc.describe(C), 'class C')
        self.assertEqual(pydoc.describe(c), 'C')
        expected = 'C in module %s object' % __name__
        self.assertTrue(expected in pydoc.render_doc(c))
开发者ID:Kanma,项目名称:Athena-Dependencies-Python,代码行数:8,代码来源:test_pydoc.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pydoc.resolve函数代码示例发布时间:2022-05-25
下一篇:
Python pydoc.plain函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap