Commit 3830743f authored by Betoule Marc's avatar Betoule Marc
Browse files

forgotten file

parent 939eb1a7
import shlex
class Directive:
def parse(self, code):
l = shlex.split(code)
it = iter(l)
if it.next() != self._name:
raise StopIteration()
for e in it:
if self.__dict__.has_key(e):
try:
setattr(self, e, it.next())
except StopIteration:
raise ValueError("The string is not a valid multiplex directive\n"+self._usage)
else:
try:
getattr(self,self._args).append(e)
except AttributeError:
setattr(self, self._args, e)
class Multiplex(Directive):
_name = "#multiplex"
_usage = "#multiplex method where 'condition' group_by 'value'"
_args = "method"
def __init__(self):
self.method = "cross_prod"
self.where = ""
self.group_by = ""
class Depend(Directive):
_name = "#depend"
_usage = "#depend file1 file2 ..."
_args = "deps"
def __init__(self):
self.deps=[]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment