()
| 204 | ) |
| 205 | |
| 206 | async def async_run(): |
| 207 | c = AttributeDict(**context) |
| 208 | c.ignore_register_page = False |
| 209 | c.updated_props = ProxySetProps(_set_props) |
| 210 | context_value.set(c) |
| 211 | errored = False |
| 212 | try: |
| 213 | if isinstance(user_callback_args, dict): |
| 214 | user_callback_output = await fn( |
| 215 | *maybe_progress, **user_callback_args |
| 216 | ) |
| 217 | elif isinstance(user_callback_args, (list, tuple)): |
| 218 | user_callback_output = await fn( |
| 219 | *maybe_progress, *user_callback_args |
| 220 | ) |
| 221 | else: |
| 222 | user_callback_output = await fn(*maybe_progress, user_callback_args) |
| 223 | except PreventUpdate: |
| 224 | # Put NoUpdate dict directly to avoid circular imports. |
| 225 | errored = True |
| 226 | cache.set( |
| 227 | result_key, |
| 228 | json.dumps( |
| 229 | {"_dash_no_update": "_dash_no_update"}, cls=PlotlyJSONEncoder |
| 230 | ), |
| 231 | ) |
| 232 | except Exception as err: # pylint: disable=broad-except |
| 233 | errored = True |
| 234 | cache.set( |
| 235 | result_key, |
| 236 | json.dumps( |
| 237 | { |
| 238 | "background_callback_error": { |
| 239 | "msg": str(err), |
| 240 | "tb": traceback.format_exc(), |
| 241 | } |
| 242 | }, |
| 243 | ), |
| 244 | ) |
| 245 | |
| 246 | if asyncio.iscoroutine(user_callback_output): |
| 247 | user_callback_output = await user_callback_output |
| 248 | |
| 249 | if not errored: |
| 250 | cache.set( |
| 251 | result_key, json.dumps(user_callback_output, cls=PlotlyJSONEncoder) |
| 252 | ) |
| 253 | |
| 254 | if inspect.iscoroutinefunction(fn): |
| 255 | func = partial(ctx.run, async_run) |
nothing calls this directly
no test coverage detected
searching dependent graphs…