File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 5
5
import flask
6
6
7
7
from . import exceptions
8
+ from ._utils import stringify_id
8
9
9
10
10
11
def has_context (func ):
@@ -76,14 +77,12 @@ def args_grouping(self):
76
77
77
78
def update_args_grouping (g ):
78
79
if isinstance (g , dict ) and "id" in g :
79
- prop_id = "." .join ((g ["id" ], g ["property" ]))
80
+ str_id = stringify_id (g ["id" ])
81
+ prop_id = "{}.{}" .format (str_id , g ["property" ])
80
82
81
83
new_values = {
82
84
"value" : g .get ("value" ),
83
- "id" : g ["id" ]
84
- if not g ["id" ].startswith ("{" )
85
- else json .loads (g ["id" ]),
86
- "property" : g ["property" ],
85
+ "str_id" : str_id ,
87
86
"triggered" : prop_id in triggered ,
88
87
}
89
88
g .update (new_values )
Original file line number Diff line number Diff line change @@ -168,6 +168,16 @@ def inputs_to_dict(inputs_list):
168
168
return inputs
169
169
170
170
171
+ def convert_to_AttributeDict (nested_list ):
172
+ new_dict = []
173
+ for i in nested_list :
174
+ if isinstance (i , dict ):
175
+ new_dict .append (AttributeDict (i ))
176
+ else :
177
+ new_dict .append ([AttributeDict (ii ) for ii in i ])
178
+ return new_dict
179
+
180
+
171
181
def inputs_to_vals (inputs ):
172
182
return [
173
183
[ii .get ("value" ) for ii in i ] if isinstance (i , list ) else i .get ("value" )
Original file line number Diff line number Diff line change 48
48
patch_collections_abc ,
49
49
split_callback_id ,
50
50
to_json ,
51
+ convert_to_AttributeDict ,
51
52
)
52
53
from . import _callback
53
54
from . import _get_paths
@@ -1310,7 +1311,8 @@ def dispatch(self):
1310
1311
# Add args_grouping
1311
1312
inputs_state_indices = cb ["inputs_state_indices" ]
1312
1313
inputs_state = inputs + state
1313
- inputs_state = [AttributeDict (i ) for i in inputs_state ]
1314
+ inputs_state = convert_to_AttributeDict (inputs_state )
1315
+
1314
1316
args_grouping = map_grouping (
1315
1317
lambda ind : inputs_state [ind ], inputs_state_indices
1316
1318
)
You can’t perform that action at this time.
0 commit comments