Skip to content

Commit 950888c

Browse files
committed
fixing for lint
1 parent 69ee069 commit 950888c

File tree

2 files changed

+34
-29
lines changed

2 files changed

+34
-29
lines changed

dash/_callback.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async def _async_invoke_callback(func, *args, **kwargs):
4848
# If the function is not a coroutine, call it directly
4949
return func(*args, **kwargs)
5050

51+
5152
def _invoke_callback(func, *args, **kwargs):
5253
return func(*args, **kwargs)
5354

@@ -503,7 +504,9 @@ async def async_add_context(*args, **kwargs):
503504
return to_json(response)
504505
else:
505506
try:
506-
output_value = await _async_invoke_callback(func, *func_args, **func_kwargs)
507+
output_value = await _async_invoke_callback(
508+
func, *func_args, **func_kwargs
509+
)
507510
except PreventUpdate as err:
508511
raise err
509512
except Exception as err: # pylint: disable=broad-exception-caught

dash/dash.py

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def _do_skip(error):
192192
# Singleton signal to not update an output, alternative to PreventUpdate
193193
no_update = _callback.NoUpdate() # pylint: disable=protected-access
194194

195+
195196
async def execute_async_function(func, *args, **kwargs):
196197
# Check if the function is a coroutine function
197198
if asyncio.iscoroutinefunction(func):
@@ -1409,9 +1410,7 @@ async def async_dispatch(self):
14091410
if asyncio.iscoroutine(response_data):
14101411
response_data = await response_data
14111412

1412-
response.set_data(
1413-
response_data
1414-
)
1413+
response.set_data(response_data)
14151414
return response
14161415

14171416
def dispatch(self):
@@ -1528,14 +1527,12 @@ def dispatch(self):
15281527
callback_context=g,
15291528
app=self,
15301529
app_on_error=self._on_error,
1531-
app_use_async=self._use_async
1530+
app_use_async=self._use_async,
15321531
)
15331532

15341533
response_data = ctx.run(partial_func)
15351534

1536-
response.set_data(
1537-
response_data
1538-
)
1535+
response.set_data(response_data)
15391536
return response
15401537

15411538
def _setup_server(self):
@@ -2352,11 +2349,12 @@ def router():
23522349
inputs.update(self.routing_callback_inputs)
23532350

23542351
if self._use_async:
2352+
23552353
@self.callback(
23562354
Output(_ID_CONTENT, "children"),
23572355
Output(_ID_STORE, "data"),
23582356
inputs=inputs,
2359-
prevent_initial_call=True
2357+
prevent_initial_call=True,
23602358
)
23612359
async def update(pathname_, search_, **states):
23622360
"""
@@ -2384,13 +2382,14 @@ async def update(pathname_, search_, **states):
23842382
title = page["title"]
23852383

23862384
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+
)
23902389
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+
)
23942393

23952394
return layout, {"title": title}
23962395

@@ -2401,20 +2400,22 @@ async def update(pathname_, search_, **states):
24012400
if not self.config.suppress_callback_exceptions:
24022401
self.validation_layout = html.Div(
24032402
[
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"]
24062406
for page in _pages.PAGE_REGISTRY.values()
24072407
]
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+
)
24152415
if _ID_CONTENT not in self.validation_layout:
24162416
raise Exception("`dash.page_container` not found in the layout")
24172417
else:
2418+
24182419
@self.callback(
24192420
Output(_ID_CONTENT, "children"),
24202421
Output(_ID_STORE, "data"),
@@ -2447,8 +2448,9 @@ def update(pathname_, search_, **states):
24472448
title = page["title"]
24482449

24492450
if callable(layout):
2450-
layout = layout(**{**(path_variables or {}), **query_parameters,
2451-
**states})
2451+
layout = layout(
2452+
**{**(path_variables or {}), **query_parameters, **states}
2453+
)
24522454
if callable(title):
24532455
title = title(**(path_variables or {}))
24542456

@@ -2461,9 +2463,9 @@ def update(pathname_, search_, **states):
24612463
if not self.config.suppress_callback_exceptions:
24622464
self.validation_layout = html.Div(
24632465
[
2464-
page["layout"]() if callable(page["layout"]) else
2465-
page[
2466-
"layout"]
2466+
page["layout"]()
2467+
if callable(page["layout"])
2468+
else page["layout"]
24672469
for page in _pages.PAGE_REGISTRY.values()
24682470
]
24692471
+ [

0 commit comments

Comments
 (0)