1 def enum(*sequential, **named):
2 enums = dict(zip(sequential, range(len(sequential))), **named)
3 return type('Enum', (), enums)
11 # being a dict this can be used with json.dumps
12 class ManifoldResult (dict):
13 def __init__ (self, code=ManifoldCode.SUCCESS, value=None, output=""):
18 def from_json (self, json_string):
19 d=json.dumps(json_string)
20 for k in ['code','value','output']:
23 # this returns None if there's a problem, the value otherwise
25 if self['code']==ManifoldCode.SUCCESS:
29 return "code=%s -- %s"%(self['code'],self['output'])