@@ -118,8 +118,7 @@ def _handle_callback_args(args, kwargs):
118
118
for arg_or_list in args
119
119
# flatten args that are lists
120
120
for arg in (
121
- arg_or_list if isinstance (arg_or_list , (list , tuple ))
122
- else [arg_or_list ]
121
+ arg_or_list if isinstance (arg_or_list , (list , tuple )) else [arg_or_list ]
123
122
)
124
123
]
125
124
return [
@@ -130,7 +129,7 @@ def _handle_callback_args(args, kwargs):
130
129
# keep list of args in order, for matching order
131
130
# in the callback's parameters
132
131
[arg for arg in args if not isinstance (arg , Output )],
133
- prevent_initial_call
132
+ prevent_initial_call ,
134
133
]
135
134
136
135
@@ -857,7 +856,9 @@ def interpolate_index(self, **kwargs):
857
856
def dependencies (self ):
858
857
return flask .jsonify (self ._callback_list )
859
858
860
- def _insert_callback (self , output , inputs , state , callback_args , prevent_initial_call ):
859
+ def _insert_callback (
860
+ self , output , inputs , state , callback_args , prevent_initial_call
861
+ ):
861
862
if prevent_initial_call is None :
862
863
prevent_initial_call = self .config .prevent_initial_callbacks
863
864
@@ -945,7 +946,13 @@ def clientside_callback(self, clientside_function, *args, **kwargs):
945
946
not to fire when its outputs are first added to the page. Defaults to
946
947
`False` unless `prevent_initial_callbacks=True` at the app level.
947
948
"""
948
- output , inputs , state , callback_args , prevent_initial_call = _handle_callback_args (args , kwargs )
949
+ (
950
+ output ,
951
+ inputs ,
952
+ state ,
953
+ callback_args ,
954
+ prevent_initial_call ,
955
+ ) = _handle_callback_args (args , kwargs )
949
956
self ._insert_callback (output , inputs , state , callback_args )
950
957
951
958
# If JS source is explicitly given, create a namespace and function
@@ -991,11 +998,17 @@ def callback(self, *args, **kwargs):
991
998
"""
992
999
# for backward compatibility, store whether first argument is a
993
1000
# list of only 1 Output
994
- specified_output_list = (
995
- isinstance (args [0 ], (list , tuple ))
996
- and len (args [0 ]) == 1 )
997
- output , inputs , state , callback_args , prevent_initial_call = _handle_callback_args (args , kwargs )
998
- callback_id = self ._insert_callback (output , inputs , state , callback_args , prevent_initial_call )
1001
+ specified_output_list = isinstance (args [0 ], (list , tuple )) and len (args [0 ]) == 1
1002
+ (
1003
+ output ,
1004
+ inputs ,
1005
+ state ,
1006
+ callback_args ,
1007
+ prevent_initial_call ,
1008
+ ) = _handle_callback_args (args , kwargs )
1009
+ callback_id = self ._insert_callback (
1010
+ output , inputs , state , callback_args , prevent_initial_call
1011
+ )
999
1012
1000
1013
def wrap_func (func ):
1001
1014
@wraps (func )
@@ -1071,8 +1084,8 @@ def dispatch(self):
1071
1084
value
1072
1085
for arg in self .callback_map [output ]["args" ]
1073
1086
for value in (inputs + state )
1074
- if arg ['id' ] == value ['id' ]
1075
- and arg [ 'property' ] == value [ 'property' ] ]
1087
+ if arg ["id" ] == value ["id" ] and arg [ "property" ] == value [ "property" ]
1088
+ ]
1076
1089
args = inputs_to_vals (args_inputs )
1077
1090
1078
1091
func = self .callback_map [output ]["callback" ]
0 commit comments