@@ -192,6 +192,7 @@ def _do_skip(error):
192
192
# Singleton signal to not update an output, alternative to PreventUpdate
193
193
no_update = _callback .NoUpdate () # pylint: disable=protected-access
194
194
195
+
195
196
async def execute_async_function (func , * args , ** kwargs ):
196
197
# Check if the function is a coroutine function
197
198
if asyncio .iscoroutinefunction (func ):
@@ -1409,9 +1410,7 @@ async def async_dispatch(self):
1409
1410
if asyncio .iscoroutine (response_data ):
1410
1411
response_data = await response_data
1411
1412
1412
- response .set_data (
1413
- response_data
1414
- )
1413
+ response .set_data (response_data )
1415
1414
return response
1416
1415
1417
1416
def dispatch (self ):
@@ -1528,14 +1527,12 @@ def dispatch(self):
1528
1527
callback_context = g ,
1529
1528
app = self ,
1530
1529
app_on_error = self ._on_error ,
1531
- app_use_async = self ._use_async
1530
+ app_use_async = self ._use_async ,
1532
1531
)
1533
1532
1534
1533
response_data = ctx .run (partial_func )
1535
1534
1536
- response .set_data (
1537
- response_data
1538
- )
1535
+ response .set_data (response_data )
1539
1536
return response
1540
1537
1541
1538
def _setup_server (self ):
@@ -2352,11 +2349,12 @@ def router():
2352
2349
inputs .update (self .routing_callback_inputs )
2353
2350
2354
2351
if self ._use_async :
2352
+
2355
2353
@self .callback (
2356
2354
Output (_ID_CONTENT , "children" ),
2357
2355
Output (_ID_STORE , "data" ),
2358
2356
inputs = inputs ,
2359
- prevent_initial_call = True
2357
+ prevent_initial_call = True ,
2360
2358
)
2361
2359
async def update (pathname_ , search_ , ** states ):
2362
2360
"""
@@ -2384,13 +2382,14 @@ async def update(pathname_, search_, **states):
2384
2382
title = page ["title" ]
2385
2383
2386
2384
if callable (layout ):
2387
- layout = await execute_async_function (layout ,
2388
- ** {** (path_variables or {}), ** query_parameters , ** states }
2389
- )
2385
+ layout = await execute_async_function (
2386
+ layout ,
2387
+ ** {** (path_variables or {}), ** query_parameters , ** states },
2388
+ )
2390
2389
if callable (title ):
2391
- title = await execute_async_function (title ,
2392
- ** (path_variables or {})
2393
- )
2390
+ title = await execute_async_function (
2391
+ title , ** (path_variables or {})
2392
+ )
2394
2393
2395
2394
return layout , {"title" : title }
2396
2395
@@ -2401,20 +2400,22 @@ async def update(pathname_, search_, **states):
2401
2400
if not self .config .suppress_callback_exceptions :
2402
2401
self .validation_layout = html .Div (
2403
2402
[
2404
- asyncio .run (execute_async_function (page ["layout" ])) if callable (page ["layout" ]) else page [
2405
- "layout" ]
2403
+ asyncio .run (execute_async_function (page ["layout" ]))
2404
+ if callable (page ["layout" ])
2405
+ else page ["layout" ]
2406
2406
for page in _pages .PAGE_REGISTRY .values ()
2407
2407
]
2408
- + [
2409
- # pylint: disable=not-callable
2410
- self .layout ()
2411
- if callable (self .layout )
2412
- else self .layout
2413
- ]
2414
- )
2408
+ + [
2409
+ # pylint: disable=not-callable
2410
+ self .layout ()
2411
+ if callable (self .layout )
2412
+ else self .layout
2413
+ ]
2414
+ )
2415
2415
if _ID_CONTENT not in self .validation_layout :
2416
2416
raise Exception ("`dash.page_container` not found in the layout" )
2417
2417
else :
2418
+
2418
2419
@self .callback (
2419
2420
Output (_ID_CONTENT , "children" ),
2420
2421
Output (_ID_STORE , "data" ),
@@ -2447,8 +2448,9 @@ def update(pathname_, search_, **states):
2447
2448
title = page ["title" ]
2448
2449
2449
2450
if callable (layout ):
2450
- layout = layout (** {** (path_variables or {}), ** query_parameters ,
2451
- ** states })
2451
+ layout = layout (
2452
+ ** {** (path_variables or {}), ** query_parameters , ** states }
2453
+ )
2452
2454
if callable (title ):
2453
2455
title = title (** (path_variables or {}))
2454
2456
@@ -2461,9 +2463,9 @@ def update(pathname_, search_, **states):
2461
2463
if not self .config .suppress_callback_exceptions :
2462
2464
self .validation_layout = html .Div (
2463
2465
[
2464
- page ["layout" ]() if callable ( page [ "layout" ]) else
2465
- page [
2466
- "layout" ]
2466
+ page ["layout" ]()
2467
+ if callable ( page ["layout" ])
2468
+ else page [ "layout" ]
2467
2469
for page in _pages .PAGE_REGISTRY .values ()
2468
2470
]
2469
2471
+ [
0 commit comments