本文整理汇总了Python中pydoc.plain函数的典型用法代码示例。如果您正苦于以下问题:Python plain函数的具体用法?Python plain怎么用?Python plain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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")
)
示例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())
示例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
示例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
示例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()
示例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.')
示例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
示例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
示例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
示例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
示例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
示例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))
示例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))
示例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.')
示例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))