MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / supervisor

Function supervisor

19-concurrency/spinner_async_experiment.py:26–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24 return 42
25
26async def supervisor() -> int:
27 spinner = asyncio.create_task(spin('thinking!')) # <1>
28 print(f'spinner object: {spinner}') # <2>
29 result = await slow() # <3>
30 spinner.cancel() # <5>
31 return result
32# end::SPINNER_ASYNC_EXPERIMENT[]
33
34def main() -> None:

Callers 1

mainFunction · 0.70

Calls 2

spinFunction · 0.70
slowFunction · 0.70

Tested by

no test coverage detected