@@ -118,8 +118,7 @@ def _handle_callback_args(args, kwargs):
118118 for arg_or_list in args
119119 # flatten args that are lists
120120 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 ]
123122 )
124123 ]
125124 return [
@@ -130,7 +129,7 @@ def _handle_callback_args(args, kwargs):
130129 # keep list of args in order, for matching order
131130 # in the callback's parameters
132131 [arg for arg in args if not isinstance (arg , Output )],
133- prevent_initial_call
132+ prevent_initial_call ,
134133 ]
135134
136135
@@ -857,7 +856,9 @@ def interpolate_index(self, **kwargs):
857856 def dependencies (self ):
858857 return flask .jsonify (self ._callback_list )
859858
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+ ):
861862 if prevent_initial_call is None :
862863 prevent_initial_call = self .config .prevent_initial_callbacks
863864
@@ -945,7 +946,13 @@ def clientside_callback(self, clientside_function, *args, **kwargs):
945946 not to fire when its outputs are first added to the page. Defaults to
946947 `False` unless `prevent_initial_callbacks=True` at the app level.
947948 """
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 )
949956 self ._insert_callback (output , inputs , state , callback_args )
950957
951958 # If JS source is explicitly given, create a namespace and function
@@ -991,11 +998,17 @@ def callback(self, *args, **kwargs):
991998 """
992999 # for backward compatibility, store whether first argument is a
9931000 # 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+ )
9991012
10001013 def wrap_func (func ):
10011014 @wraps (func )
@@ -1071,8 +1084,8 @@ def dispatch(self):
10711084 value
10721085 for arg in self .callback_map [output ]["args" ]
10731086 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+ ]
10761089 args = inputs_to_vals (args_inputs )
10771090
10781091 func = self .callback_map [output ]["callback" ]
0 commit comments