@@ -54,7 +54,7 @@ class CodeExercise(VBox, CheckableWidget, ExerciseWidget):
5454 :param outputs:
5555 List of CueOuputs that are drawn and refreshed
5656
57- :param update_func :
57+ :param update :
5858 A function that is run during the update process. The function takes as argument
5959 the CodeExercise, so it can update all cue_ouputs
6060
@@ -71,7 +71,7 @@ def __init__(
7171 ] = None ,
7272 update_mode : str = "manual" ,
7373 outputs : Union [None , Figure , CueOutput , List [CueOutput ]] = None ,
74- update_func : Optional [
74+ update : Optional [
7575 Union [
7676 Callable [[CodeExercise ], Union [Any , Check .FunOutParamsT ]],
7777 Callable [[], Union [Any , Check .FunOutParamsT ]],
@@ -95,20 +95,22 @@ def __init__(
9595 Callable [[CodeExercise ], Union [Any , Check .FunOutParamsT ]],
9696 Callable [[], Union [Any , Check .FunOutParamsT ]],
9797 ]
98- ] = update_func
98+ ] = update
9999
100+ # We test update instead of self._update_func because self._update_func
101+ # has one additional argument because of self
100102 self ._update_func_nb_nondefault_args : Optional [int ]
101- if update_func is not None :
103+ if update is not None :
102104 self ._update_func_nb_nondefault_args = len (
103105 [
104106 value
105- for value in inspect .signature (update_func ).parameters .values ()
107+ for value in inspect .signature (update ).parameters .values ()
106108 if not isinstance (value .default , inspect ._empty )
107109 ]
108110 )
109111 if self ._update_func_nb_nondefault_args > 1 :
110112 raise ValueError (
111- f"The given update_func has "
113+ f"The given update function has "
112114 f"{ self ._update_func_nb_nondefault_args } parameters without "
113115 "defaults, but only zero or one are supported."
114116 )
@@ -160,7 +162,7 @@ def __init__(
160162
161163 # check compability between code and params, can only be checked if
162164 # update_func is not used because we cannot know how the code input is used
163- if update_func is None and code is not None and params is not None :
165+ if update is None and code is not None and params is not None :
164166 if isinstance (params , dict ):
165167 compatibility_result = code .compatible_with_signature (
166168 list (params .keys ())
0 commit comments