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

Python pydoc.plain函数代码示例

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

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例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():
    """
    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


示例11: 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


示例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():
    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


示例14: 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


示例15: main

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


示例16: 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


示例17: main

def main():
    print(pydoc.plain(pydoc.render_doc(topology.connected)))
    # Create list of mounted devices that are in our settings.config
    mounted_devices = [ name for name in topology.mounted_nodes() if name in settings.config['network_device'] ]
    if not mounted_devices:
        print('There are no devices mounted on the Controller.')
    else:
        device_name = mounted_devices[0]
        print('is_connected(%s):' % device_name, topology.connected(device_name))
开发者ID:CTOCHN,项目名称:cosc-learning-labs,代码行数:9,代码来源:is_connected.py


示例18: 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


示例19: 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


示例20: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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