本文整理汇总了Python中Library.listDistributions方法的典型用法代码示例。如果您正苦于以下问题:Python Library.listDistributions方法的具体用法?Python Library.listDistributions怎么用?Python Library.listDistributions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library.listDistributions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setDistrType
# 需要导入模块: import Library [as 别名]
# 或者: from Library import listDistributions [as 别名]
def setDistrType(self, distrType):
distroList = Library.listDistributions("all")
for distName in distroList:
if distrType.lower() == distName.lower():
return distrType
raise Exception("Distribution module '%s' does not exist. Check the name" % (distrType))
示例2: get_distributions
# 需要导入模块: import Library [as 别名]
# 或者: from Library import listDistributions [as 别名]
def get_distributions():
'''
List all available distributions
'''
ET.register_namespace("test", "http://127.0.0.1/cocoma")
response.set_header('Content-Type', 'application/vnd.bonfire+xml')
response.set_header('Accept', '*/*')
response.set_header('Allow', 'GET, HEAD')
distroList=Library.listDistributions("all")
#print "distroList",distroList
'''
XML namespaces are used for providing uniquely named elements and attributes in an XML document.
'''
#building the XML we will return
distributions = ET.Element('collection', { 'xmlns':'http://127.0.0.1/cocoma','href':'/distributions'})
#<items offset="0" total="2">
items =ET.SubElement(distributions,'items', { 'offset':'0','total':str(len(distroList))})
#<distribution href="/emulations/1" name="Emu1"/>
for elem in distroList :
distribution = ET.SubElement(items,'distribution', { 'href':'/distributions/'+str(elem),'name':str(elem)})
#<link href="/" rel="parent" type="application/vnd.cocoma+xml"/>
lk = ET.SubElement(distributions, 'link', {'rel':'parent', 'href':'/', 'type':'application/vnd.bonfire+xml'})
return prettify(distributions)
示例3: noExtraOptions
# 需要导入模块: import Library [as 别名]
# 或者: from Library import listDistributions [as 别名]
else:
print "Please respond with 'yes' or 'no'"
except KeyboardInterrupt,e:
print "\nAction cancelled"
'''
################################
listDistro
###############################
'''
if options.listAllDistro:
noExtraOptions(options, "listAllDistro")
if len(arguments)>0:
try:
distroList=Library.listDistributions(arguments[0])
print distroList
except Exception, e:
print "Error: ",e
print "Distribution \"%s\" not found. Check name."%(arguments[0])
else:
distroList=Library.listDistributions("all")
print "\nAvailable distributions:"
for distName in distroList:
print distName
'''
################################