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

Python pydoc.doc函数代码示例

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

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



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

示例1: test02_dir

    def test02_dir(self):
        """For the same reasons as test01_kdcraw, this used to crash."""

        import cppyy, pydoc

        assert not '__abstractmethods__' in dir(cppyy.gbl.gInterpreter)
        assert '__class__' in dir(cppyy.gbl.gInterpreter)

        self.__class__.helpout = []
        pydoc.doc(cppyy.gbl.gInterpreter)
        helptext = ''.join(self.__class__.helpout)
        assert 'TInterpreter' in helptext
        assert 'CPPInstance' in helptext
        assert 'AddIncludePath' in helptext

        cppyy.cppdef("namespace cppyy_regression_test { void iii() {}; }")

        assert not 'iii' in cppyy.gbl.cppyy_regression_test.__dict__
        assert not '__abstractmethods__' in dir(cppyy.gbl.cppyy_regression_test)
        assert '__class__' in dir(cppyy.gbl.cppyy_regression_test)
        assert 'iii' in dir(cppyy.gbl.cppyy_regression_test)

        assert not 'iii' in cppyy.gbl.cppyy_regression_test.__dict__
        assert cppyy.gbl.cppyy_regression_test.iii
        assert 'iii' in cppyy.gbl.cppyy_regression_test.__dict__

        self.__class__.helpout = []
        pydoc.doc(cppyy.gbl.cppyy_regression_test)
        helptext = ''.join(self.__class__.helpout)
        assert 'CPPInstance' in helptext
开发者ID:etejedor,项目名称:root,代码行数:30,代码来源:test_regression.py


示例2: test01_kdcraw

    def test01_kdcraw(self):
        """Doc strings for KDcrawIface (used to crash)."""

        import cppyy, pydoc

        # TODO: run a find for these paths
        qtpath = "/usr/include/qt5"
        kdcraw_h = "/usr/include/KF5/KDCRAW/kdcraw/kdcraw.h"
        if not os.path.isdir(qtpath) or not os.path.exists(kdcraw_h):
            import warnings
            warnings.warn("no KDE/Qt found, skipping test01_kdcraw")
            return

        # need to resolve qt_version_tag for the incremental compiler; since
        # it's not otherwise used, just make something up
        cppyy.cppdef("int qt_version_tag = 42;")
        cppyy.add_include_path(qtpath)
        cppyy.include(kdcraw_h)

        from cppyy.gbl import KDcrawIface

        self.__class__.helpout = []
        pydoc.doc(KDcrawIface.KDcraw)
        helptext  = ''.join(self.__class__.helpout)
        assert 'KDcraw' in helptext
        assert 'CPPInstance' in helptext
开发者ID:etejedor,项目名称:root,代码行数:26,代码来源:test_regression.py


示例3: main

def main():
    print(plain(doc(device_mount)))
    for device_name in inventory_unmounted():
        demonstrate(device_name)
        return os.EX_OK
    print('All configured devices are mounted. Demonstration cancelled.')
    return os.EX_TEMPFAIL
开发者ID:chayden001,项目名称:cosc-learning-labs,代码行数:7,代码来源:01_device_mount.py


示例4: draw

def draw():
    """ Select a device/interface and demonstrate."""
    print(plain(doc(interface_configuration)))
    foundInterface = False

    G = nx.Graph()

    for device_name in sorted(inventory_connected()):
        G.add_node(device_name)
        print("%s:" % device_name)
        mgmt_name = management_interface(device_name)
        for interface_name in sorted(interface_names(device_name)):
            # Choose interface on 'data plane' not 'control plane'.
            if interface_name == mgmt_name:
                continue
            else:
                match(device_name, interface_name)
                foundInterface = True
                demonstrate(device_name, interface_name)
                to_interface = interface_configuration(device_name, interface_name)[1].split(" ")[1]
                print("interface:%s" % to_interface)
                G.add_edge(device_name, to_interface)
        if not foundInterface:
            print("There are no suitable network interfaces for this device.")

    print(G.nodes())
    print(G.edges())
    # nx.draw(G)
    nx.draw_networkx(G, with_labels=True)
    plt.show()
开发者ID:thunderleo,项目名称:opendaylight-bootcamps,代码行数:30,代码来源:gui.py


示例5: main

def main():
    """ 
    Print the documentation then perform the demonstration(s).
    """
    print(plain(doc(static_route_delete)))

    print('Determine which devices are capable.')
    print('inventory_static_route()')
    inventory = inventory_static_route()
    print_table(inventory, headers='device-name')
    if not inventory:
        print("There are no 'static route' capable devices. Demonstration cancelled.")
    else:
        print()
        for device_name in inventory:
            print('static_route_list(%s)' % device_name)
            route_list = static_route_list(device_name)
            print_table(route_list, headers='destination-network')
            print()
            if route_list:
                demonstrate_one(device_name, route_list[0])
                if len(route_list) > 1:
                    demonstrate_all(device_name)
                return EX_OK
        print("There are no devices with a 'static route' configured. Demonstration cancelled.")
    return EX_TEMPFAIL
开发者ID:brixcode,项目名称:cosc-learning-labs,代码行数:26,代码来源:04_static_route_delete.py


示例6: main

def main():
    ''' Select a device and demonstrate.'''
    print(plain(doc(acl_apply_packet_filter)))
    inventory = inventory_acl()
    if not inventory:
        print('There are no ACL capable devices to examine. Demonstration cancelled.')
    else:
        for device_name in inventory:
            mgmt_name = management_interface(device_name)
            acl_names = acl_list(device_name)
            if not acl_names:
                print('Skip device with no ACLs: ', device_name)
                continue
            else:
                random.shuffle(acl_names)
                acl_name = acl_names[0]
            for ic in interface_configuration_tuple(device_name):
                if ic.name == mgmt_name:
                    continue
                print('Consider %s %s in=%s, out=%s' % (device_name, ic.name, ic.packet_filter_inbound, ic.packet_filter_outbound))
                if not ic.packet_filter_outbound:
                    demonstrate(device_name, ic.name, 'outbound', acl_name)
                    return EX_OK
                if not ic.packet_filter_inbound:
                    demonstrate(device_name, ic.name, 'inbound', acl_name)
                    return EX_OK
        print('There are no network interfaces available to apply an ACL. Demonstration cancelled.')
    return EX_TEMPFAIL
开发者ID:djordjevulovic,项目名称:cosc-learning-labs,代码行数:28,代码来源:05_acl_apply_packet_filter.py


示例7: main

def main():
    """
    Print the function documentation then demonstrate the function usage.
    """
    print(plain(doc(inventory_static_route)))
    
    return EX_OK if demonstrate() else EX_TEMPFAIL
开发者ID:chayden001,项目名称:cosc-learning-labs,代码行数:7,代码来源:04_static_route_capability.py


示例8: main

def main():
    print(plain(doc(device_dismount)))
    for device_name in inventory_mounted():
        demonstrate(device_name)
        return EX_OK
    print('There are no mounted devices to dismount. Demonstration cancelled.')
    return EX_TEMPFAIL
开发者ID:brixcode,项目名称:cosc-learning-labs,代码行数:7,代码来源:01_device_dismount.py


示例9: main

def main():
    ''' Document and demonstrate the function.'''
    print(plain(doc(inventory_static_route)))
    if demonstrate():
        return os.EX_OK
    else:
        return os.EX_TEMPFAIL
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:7,代码来源:04_inventory_static_route.py


示例10: main

def main():
    ''' Select a device and demonstrate.'''
    print(plain(doc(management_interface)))
    for device_name in inventory_mounted():
        demonstrate(device_name)
        return os.EX_OK
    print("There are no suitable network devices. Demonstration cancelled.")
    return os.EX_TEMPFAIL
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:8,代码来源:03_management_interface.py


示例11: main

def main():
    print(plain(doc(connected)))
    device_names = inventory_mounted()
    if not device_names:
        print('There are no devices mounted on the Controller.')
    else:
        device_name = device_names[0]
        print('is connected(%s):' % device_name, connected(device_name))
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:8,代码来源:01_device_connected.py


示例12: main

def main():
    print(plain(doc(mounted)))
    device_names = settings.config['network_device'].keys()
    if not device_names:
        print('There are no devices configured in the settings.')
    else:
        device_name = next(iter(device_names))
        print('is mounted(%s):' % device_name, mounted(device_name))
开发者ID:brixcode,项目名称:cosc-learning-labs,代码行数:8,代码来源:01_device_mounted.py


示例13: main

def main():
    """ Select a device and demonstrate."""
    print(plain(doc(device_control)))
    print("DeviceControl fields:", *DeviceControl._fields, sep="\n\t", end="\n\n")
    for device_name in inventory_mounted():
        demonstrate(device_name)
        return EX_OK
    print("There are no suitable network devices. Demonstration cancelled.")
    return EX_TEMPFAIL
开发者ID:ingtiti,项目名称:cosc-learning-labs,代码行数:9,代码来源:device_control.py


示例14: main

def main():
    ''' Select a device and demonstrate.'''
    print(plain(doc(interface_names)))
    mounted_list = inventory_mounted()
    connected_list = inventory_connected()
    device_list = list(set(connected_list) & set(mounted_list))
    for device_name in device_list:
        return demonstrate(device_name)
    print('There are no mounted, connected devices to examine. Demonstration cancelled.')
开发者ID:brixcode,项目名称:cosc-learning-labs,代码行数:9,代码来源:03_interface_names.py


示例15: test03_pyfunc_doc

    def test03_pyfunc_doc(self):
        """Help on a generated pyfunc used to crash."""

        import cppyy, distutils, pydoc, sys

        cppyy.add_include_path(distutils.sysconfig_get_python_inc())
        if sys.hexversion < 0x3000000:
            cppyy.cppdef("#undef _POSIX_C_SOURCE")
            cppyy.cppdef("#undef _XOPEN_SOURCE")
        else:
            cppyy.cppdef("#undef slots")     # potentially pulled in by Qt/xapian.h

        cppyy.cppdef("""#include "Python.h"
           long py2long(PyObject* obj) { return PyLong_AsLong(obj); }""")

        pydoc.doc(cppyy.gbl.py2long)

        assert 1 == cppyy.gbl.py2long(1)
开发者ID:etejedor,项目名称:root,代码行数:18,代码来源:test_regression.py


示例16: main

def main():
    ''' Select a device and demonstrate.'''
    print(plain(doc(device_control)))
    print('DeviceControl fields:', *DeviceControl._fields, sep='\n\t', end='\n\n')
    for device_name in inventory_mounted():
        demonstrate(device_name)
        return os.EX_OK
    print("There are no suitable network devices. Demonstration cancelled.")
    return os.EX_TEMPFAIL
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:9,代码来源:01_device_control.py


示例17: main

def main():
    print(plain(doc(device_dismount)))
    mounted_list = inventory_mounted()
    if not mounted_list:
        print("There are no mounted devices to dismount.")
    else:
        for device_name in mounted_list:
            print("device_dismount(" + device_name, end=")\n")
            device_dismount(device_name)
开发者ID:ingtiti,项目名称:cosc-learning-labs,代码行数:9,代码来源:01_inventory_dismount.py


示例18: main

def main():
    ''' Select a device and demonstrate.'''
    print(plain(doc(acl_list)))
    inventory = inventory_acl()
    if not inventory:
        print('There are no ACL capable devices to examine. Demonstration cancelled.')
    else:
        for device_name in inventory:
            if demonstrate(device_name):
                return EX_OK
    return EX_TEMPFAIL
开发者ID:brixcode,项目名称:cosc-learning-labs,代码行数:11,代码来源:05_acl_list.py


示例19: main

def main():
    ''' Select a device and demonstrate on potential routes, repeat until information found.'''
    print(plain(doc(static_route_json)))
    inventory = inventory_static_route()
    if not inventory:
        print("There are no 'static route' capable devices to examine. Demonstration cancelled.")
    else:
        for device_name in inventory:
            if demonstrate(device_name):
                return os.EX_OK
    return os.EX_TEMPFAIL
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:11,代码来源:04_static_route_json.py


示例20: main

def main():
    """ Select a device and demonstrate. If no information is found then retry with a different device."""
    print(plain(doc(static_route_list)))
    device_names = inventory_static_route()
    if not device_names:
        print("There are no 'static route' capable devices to examine. Demonstration cancelled.")
    else:
        for device_name in device_names:
            if demonstrate(device_name):
                return os.EX_OK
    return os.EX_TEMPFAIL
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:11,代码来源:04_static_route_list.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python pydoc.getdoc函数代码示例发布时间:2022-05-25
下一篇:
Python pydoc.describe函数代码示例发布时间: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