(kwargs)
| 223 | |
| 224 | |
| 225 | def extract_grouped_input_state_callback_args_from_kwargs(kwargs): |
| 226 | input_parameters = kwargs["inputs"] |
| 227 | if isinstance(input_parameters, DashDependency): |
| 228 | input_parameters = [input_parameters] |
| 229 | |
| 230 | state_parameters = kwargs.get("state", None) |
| 231 | if isinstance(state_parameters, DashDependency): |
| 232 | state_parameters = [state_parameters] |
| 233 | |
| 234 | if isinstance(input_parameters, dict): |
| 235 | # Wrapped function will be called with named keyword arguments |
| 236 | if state_parameters: |
| 237 | if not isinstance(state_parameters, dict): |
| 238 | raise ValueError( |
| 239 | "The input argument to app.callback was a dict, " |
| 240 | "but the state argument was not.\n" |
| 241 | "input and state arguments must have the same type" |
| 242 | ) |
| 243 | |
| 244 | # Merge into state dependencies |
| 245 | parameters = state_parameters |
| 246 | parameters.update(input_parameters) |
| 247 | else: |
| 248 | parameters = input_parameters |
| 249 | |
| 250 | return parameters |
| 251 | |
| 252 | if isinstance(input_parameters, (list, tuple)): |
| 253 | # Wrapped function will be called with positional arguments |
| 254 | parameters = list(input_parameters) |
| 255 | if state_parameters: |
| 256 | if not isinstance(state_parameters, (list, tuple)): |
| 257 | raise ValueError( |
| 258 | "The input argument to app.callback was a list, " |
| 259 | "but the state argument was not.\n" |
| 260 | "input and state arguments must have the same type" |
| 261 | ) |
| 262 | |
| 263 | parameters += list(state_parameters) |
| 264 | |
| 265 | return parameters |
| 266 | |
| 267 | raise ValueError( |
| 268 | "The input argument to app.callback may be a dict, list, or tuple,\n" |
| 269 | f"but received value of type {type(input_parameters)}" |
| 270 | ) |
| 271 | |
| 272 | |
| 273 | def extract_grouped_input_state_callback_args_from_args(args): |
no test coverage detected
searching dependent graphs…