MCPcopy Create free account
hub / github.com/pallets/quart / decorator

Function decorator

src/quart/cli.py:288–304  ·  view source on GitHub ↗
(__ctx: click.Context, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

286
287 @click.pass_context
288 def decorator(__ctx: click.Context, *args: Any, **kwargs: Any) -> Any:
289 async def _inner() -> Any:
290 async with __ctx.ensure_object(ScriptInfo).load_app().app_context():
291 try:
292 return __ctx.invoke(fn, *args, **kwargs)
293 except RuntimeError as error:
294 if (
295 error.args[0]
296 == "Cannot run the event loop while another loop is running"
297 ):
298 click.echo(
299 "The appcontext cannot be used with a command that"
300 " runs an event loop. See quart#361 for more details"
301 )
302 raise
303
304 return asyncio.run(_inner())
305
306 return functools.update_wrapper(decorator, fn)
307

Callers 1

as_viewMethod · 0.85

Calls 2

runMethod · 0.80
_innerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…