@@ -45,7 +45,7 @@ def _writejson(obj):
45
45
def _log (message ):
46
46
if not isinstance (message , util .strbase ):
47
47
message = json .encode (message )
48
- _writejson ({ 'log' : message } )
48
+ _writejson ([ 'log' , message ] )
49
49
50
50
def reset (config = None ):
51
51
del functions [:]
@@ -57,15 +57,15 @@ def add_fun(string):
57
57
try :
58
58
util .pyexec (string , {'log' : _log }, globals_ )
59
59
except Exception as e :
60
- return { 'error' : {
61
- 'id' : ' map_compilation_error' ,
62
- 'reason' : e .args [0 ]
63
- }}
64
- err = { 'error' : {
65
- 'id' : ' map_compilation_error' ,
66
- 'reason' : ' string must eval to a function '
60
+ return [ 'error' ,
61
+ 'map_compilation_error' ,
62
+ e .args [0 ]
63
+ ]
64
+ err = [ 'error' ,
65
+ 'map_compilation_error' ,
66
+ 'string must eval to a function '
67
67
'(ex: "def(doc): return 1")'
68
- }}
68
+ ]
69
69
if len (globals_ ) != 1 :
70
70
return err
71
71
function = list (globals_ .values ())[0 ]
@@ -95,15 +95,15 @@ def reduce(*cmd, **kwargs):
95
95
except Exception as e :
96
96
log .error ('runtime error in reduce function: %s' , e ,
97
97
exc_info = True )
98
- return { 'error' : {
99
- 'id' : ' reduce_compilation_error' ,
100
- 'reason' : e .args [0 ]
101
- }}
102
- err = { 'error' : {
103
- 'id' : ' reduce_compilation_error' ,
104
- 'reason' : ' string must eval to a function '
98
+ return [ 'error' ,
99
+ 'reduce_compilation_error' ,
100
+ e .args [0 ]
101
+ ]
102
+ err = [ 'error' ,
103
+ 'reduce_compilation_error' ,
104
+ 'string must eval to a function '
105
105
'(ex: "def(keys, values): return 1")'
106
- }}
106
+ ]
107
107
if len (globals_ ) != 1 :
108
108
return err
109
109
function = list (globals_ .values ())[0 ]
0 commit comments