本文整理汇总了Python中Table.Table.processOutputInstructions方法的典型用法代码示例。如果您正苦于以下问题:Python Table.processOutputInstructions方法的具体用法?Python Table.processOutputInstructions怎么用?Python Table.processOutputInstructions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table.Table
的用法示例。
在下文中一共展示了Table.processOutputInstructions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Table import Table [as 别名]
# 或者: from Table.Table import processOutputInstructions [as 别名]
def main ():
prog = sys.argv[1]
## open program to parse (read whole program into memory, it's small enough)
with open(prog,'r') as f:
towerProgram = Program.removeCommentedText(f.read())
### parse instrumentlibrary for additional metadata
insLib = parse('instrumentlibrary.xml')
## parse program to get aliases, constants, and units
aliases = Program.getAliases(towerProgram)
constants = Program.getConstants(towerProgram)
units = Program.getUnits(towerProgram)
## start and initialize new xml for this program
doc = xmlutils.createNewProgramXML()
xmlutils.addTextNodeToRoot(doc,"progName",prog)
tablesNode = xmlutils.addNode(doc,'root','tables')
### put datatable info in the progxml
tables = Program.getTables(towerProgram)
for text in tables:
### use text and program info to construct Table object
table = Table(text,aliases,constants,units)
### add table info (name and interval) to xml
tableNode = doc.createElement("table")
table.addTableInfo(doc,tableNode)
### process output instructions and store variable info
### to the progxml
variablesNode = xmlutils.addNode(doc,tableNode,'variables')
table.processOutputInstructions(doc,variablesNode,insLib)
tablesNode.appendChild(tableNode)
#do some cleaning up of xml (so it's easy for humans to view in texteditor)
progxml = xmlutils.cleanupXML(doc)
### save progxml
xmlout = open(prog + '.xml','w')
print >>xmlout, progxml