本文整理汇总了Python中astrodata.AstroData.all_descriptors方法的典型用法代码示例。如果您正苦于以下问题:Python AstroData.all_descriptors方法的具体用法?Python AstroData.all_descriptors怎么用?Python AstroData.all_descriptors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astrodata.AstroData
的用法示例。
在下文中一共展示了AstroData.all_descriptors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_GET
# 需要导入模块: from astrodata import AstroData [as 别名]
# 或者: from astrodata.AstroData import all_descriptors [as 别名]
#.........这里部分代码省略.........
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(content)
return
if parms["path"] == "/adinfo":
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
if "filename" not in parms:
return "Error: Need Filename Parameter"
if "filename" in parms:
try:
ad = AstroData(parms["filename"][0])
except:
self.wfile.write("Can't use AstroData to open %s" % parms["filename"])
return
if "fullpage" in parms:
self.wfile.write("<html><body>")
if "fullpage" not in parms:
# defaults to false
self.wfile.write("<b>Name</b>: %s \n" % os.path.basename(ad.filename))
self.wfile.write("<br/><b>Path</b>: %s \n" % os.path.abspath(ad.filename))
self.wfile.write("<br/><b>Types</b>: %s\n" % ", ".join(ad.types))
recdict = rl.get_applicable_recipes(ad, collate=True)
keys = recdict.keys()
keys.sort()
for key in keys:
recname = recdict[key]
self.wfile.write("<br/><b>Default Recipe(s)</b>:%s "+\
"(<i>due to type</i>: %s)" % (recname, key))
alldesc = ad.all_descriptors()
self.wfile.write("<br/><b>Descriptors</b>:\n")
self.wfile.write('<table style="margin-left:4em">\n')
adkeys = alldesc.keys()
adkeys.sort()
self.wfile.flush()
for desc in adkeys:
value = str(alldesc[desc])
if "ERROR" in value:
value = '<span style="color:red">' + value + '</span>'
self.wfile.write("<tr><td>%s</td><td>%s</td></tr>\n" % (desc, value))
self.wfile.flush()
self.wfile.write("</table>")
if "fullpage" in parms:
self.wfile.write("</body></html>")
return
if parms["path"] == "/recipes.xml":
self.send_response(200)
self.send_header('Content-type', 'text/xml')
self.send_header("Access-Control-Allow-Origin", "http://localhost")
self.end_headers()
self.wfile.write(rl.list_recipes(as_xml = True) )
return
if parms["path"] == "/reduceconfigs.xml":
import glob
rcfgs = glob.glob("./*.rcfg")
self.send_response(200)
self.send_header('Content-type', 'text/xml')
self.end_headers()
retxml = '<?xml version="1.0" encoding="UTF-8" ?>\n'
retxml += "<reduceconfigs>\n"