Archive

Posts Tagged ‘parser’

and the runner is…

28 May 2008 Leave a comment

well, in the spare time I have coded the software which has been in my wishlist for a few weeks: the runner.

runner.py is a small program which takes an xml configuration file as input, manages the actions defined for each item in this configuration and checks that they’ve correctly been performed.

in a couple of lines (they’re almost the same in python):

configuration = parse(xmlsource)
for priority in configuration.priorities:
    play(priority)
    windup(priority)

and play is like the following

for each operation in configuration.operations[priority]:
    eval("self."+operation.get('type') + "(operation)")

and the windup is like the following

for each operation in configuration.operations[priority]:
    eval("self."+operation.get('type') + "(operation)")

voila, c’est tout.

Advertisement
Categories: Uncategorized Tags: , , ,