2929
3030
3131class QuartDashServer (BaseDashServer ):
32-
3332 def __init__ (self , server : Quart ) -> None :
3433 self .server_type = "quart"
3534 self .server : Quart = server
@@ -41,7 +40,9 @@ def __call__(self, *args: Any, **kwargs: Any): # type: ignore[name-defined]
4140 return self .server (* args , ** kwargs )
4241
4342 @staticmethod
44- def create_app (name : str = "__main__" , config : _t .Optional [_t .Dict [str , _t .Any ]] = None ):
43+ def create_app (
44+ name : str = "__main__" , config : _t .Optional [_t .Dict [str , _t .Any ]] = None
45+ ):
4546 if Quart is None :
4647 raise RuntimeError (
4748 "Quart is not installed. Install with 'pip install quart' to use the quart backend."
@@ -225,7 +226,6 @@ async def _invalid_resource(err):
225226 return err .args [0 ], 404
226227
227228 def _html_response_wrapper (self , view_func : _t .Callable [..., _t .Any ] | str ):
228-
229229 async def wrapped (* _args , ** _kwargs ):
230230 html_val = view_func () if callable (view_func ) else view_func
231231 if inspect .iscoroutine (html_val ): # handle async function returning html
@@ -247,15 +247,13 @@ def add_url_rule(
247247 )
248248
249249 def setup_index (self , dash_app : Dash ): # type: ignore[name-defined]
250-
251250 async def index (* args , ** kwargs ):
252251 return Response (dash_app .index (* args , ** kwargs ), content_type = "text/html" ) # type: ignore[arg-type]
253252
254253 # pylint: disable=protected-access
255254 dash_app ._add_url ("" , index , methods = ["GET" ])
256255
257256 def setup_catchall (self , dash_app : Dash ):
258-
259257 async def catchall (
260258 path : str , * args , ** kwargs
261259 ): # noqa: ARG001 - path is unused but kept for route signature, pylint: disable=unused-argument
@@ -331,7 +329,6 @@ async def serve(package_name, fingerprinted_path):
331329
332330 # pylint: disable=unused-argument
333331 def dispatch (self , dash_app : Dash ): # type: ignore[name-defined] Quart always async
334-
335332 async def _dispatch ():
336333 adapter = QuartRequestAdapter ()
337334 body = await adapter .get_json ()
@@ -351,7 +348,9 @@ async def _dispatch():
351348
352349 return _dispatch
353350
354- def register_callback_api_routes (self , callback_api_paths : _t .Dict [str , _t .Callable [..., _t .Any ]]):
351+ def register_callback_api_routes (
352+ self , callback_api_paths : _t .Dict [str , _t .Callable [..., _t .Any ]]
353+ ):
355354 """
356355 Register callback API endpoints on the Quart app.
357356 Each key in callback_api_paths is a route, each value is a handler (sync or async).
0 commit comments