MCPcopy
hub / github.com/encode/starlette / BackgroundTask

Class BackgroundTask

starlette/background.py:12–23  ·  starlette/background.py::BackgroundTask

Source from the content-addressed store, hash-verified

10
11
12class BackgroundTask:
13 def __init__(self, func: Callable[P, Any], *args: P.args, **kwargs: P.kwargs) -> None:
14 self.func = func
15 self.args = args
16 self.kwargs = kwargs
17 self.is_async = is_async_callable(func)
18
19 async def __call__(self) -> None:
20 if self.is_async:
21 await self.func(*self.args, **self.kwargs)
22 else:
23 await run_in_threadpool(self.func, *self.args, **self.kwargs)
24
25
26class BackgroundTasks(BackgroundTask):

Callers 10

appFunction · 0.90
test_file_responseFunction · 0.90
test_async_taskFunction · 0.90
test_sync_taskFunction · 0.90
simple_endpointFunction · 0.90
dispatchMethod · 0.90
endpointFunction · 0.90
add_taskMethod · 0.85

Calls

no outgoing calls

Tested by 9

appFunction · 0.72
test_file_responseFunction · 0.72
test_async_taskFunction · 0.72
test_sync_taskFunction · 0.72
simple_endpointFunction · 0.72
dispatchMethod · 0.72
endpointFunction · 0.72