Add basic typing to the `debugging/` examples
Sweep the `examples/debugging/` set for basic typing: add `-> None` to all 16 bare `async def main()`s and annotate the clean single-line `open_nursery()` bindings as `tractor.ActorNursery`. Kept to the unambiguous, runtime-safe cases (these breakpoint/crash demos can't be run headless); the heterogeneous multi-line/paren-group nursery bindings + `current_actor()` returns are left for a later pass. Continues the examples-typing bullet in #472. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codewkt/big_boi_docs_472_follow_ups
parent
adf71d74e8
commit
fc809b5275
|
|
@ -35,7 +35,7 @@ async def open_ctx(
|
|||
assert first is None
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
|
||||
async with tractor.open_nursery(
|
||||
debug_mode=True,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ async def name_error():
|
|||
getattr(doggypants) # noqa
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
'''
|
||||
Test breakpoint in a streaming actor.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ async def breakpoint_forever():
|
|||
async def spawn_until(depth=0):
|
||||
""""A nested nursery that triggers another ``NameError``.
|
||||
"""
|
||||
n: tractor.ActorNursery
|
||||
async with tractor.open_nursery() as n:
|
||||
if depth < 1:
|
||||
|
||||
|
|
@ -46,7 +47,7 @@ async def spawn_until(depth=0):
|
|||
|
||||
|
||||
# TODO: notes on the new boxed-relayed errors through proxy actors
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
"""The main ``tractor`` routine.
|
||||
|
||||
The process tree should look as approximately as follows when the debugger
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ async def name_error():
|
|||
async def spawn_error():
|
||||
""""A nested nursery that triggers another ``NameError``.
|
||||
"""
|
||||
n: tractor.ActorNursery
|
||||
async with tractor.open_nursery() as n:
|
||||
portal = await n.run_in_actor(
|
||||
name_error,
|
||||
|
|
@ -23,7 +24,7 @@ async def spawn_error():
|
|||
return await portal.result()
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
"""The main ``tractor`` routine.
|
||||
|
||||
The process tree should look as approximately as follows:
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ async def name_error():
|
|||
async def spawn_error():
|
||||
""""A nested nursery that triggers another ``NameError``.
|
||||
"""
|
||||
n: tractor.ActorNursery
|
||||
async with tractor.open_nursery() as n:
|
||||
portal = await n.run_in_actor(
|
||||
name_error,
|
||||
|
|
@ -25,7 +26,7 @@ async def spawn_error():
|
|||
return await portal.result()
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
"""The main ``tractor`` routine.
|
||||
|
||||
The process tree should look as approximately as follows:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ async def die():
|
|||
raise RuntimeError
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
tn: tractor.ActorNursery
|
||||
async with tractor.open_nursery() as tn:
|
||||
|
||||
debug_actor = await tn.start_actor(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ async def name_error(
|
|||
raise
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
'''
|
||||
Test 3 `PdbREPL` entries:
|
||||
- one in the child due to manual `.post_mortem()`,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import trio
|
|||
import tractor
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
|
||||
async with tractor.open_root_actor(
|
||||
debug_mode=True,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import trio
|
|||
import tractor
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
async with tractor.open_root_actor(
|
||||
debug_mode=True,
|
||||
):
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ async def name_error():
|
|||
async def spawn_until(depth=0):
|
||||
""""A nested nursery that triggers another ``NameError``.
|
||||
"""
|
||||
n: tractor.ActorNursery
|
||||
async with tractor.open_nursery() as n:
|
||||
if depth < 1:
|
||||
# await n.run_in_actor('breakpoint_forever', breakpoint_forever)
|
||||
|
|
@ -23,7 +24,7 @@ async def spawn_until(depth=0):
|
|||
)
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
'''
|
||||
The process tree should look as approximately as follows when the
|
||||
debugger first engages:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import trio
|
|||
import tractor
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
async with tractor.open_root_actor(
|
||||
debug_mode=True,
|
||||
loglevel='cancel',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ async def key_error():
|
|||
return {}['doggy']
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
'''
|
||||
Root is fail-after-cancelled while blocking and child RPC fails
|
||||
simultaneously.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ async def cancelled_before_pause(
|
|||
await pm_on_cancelled()
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
async with tractor.open_nursery(
|
||||
debug_mode=True,
|
||||
) as n:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ async def just_bp(
|
|||
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
|
||||
# !TODO, parametrize the --tpt-proto={key} with osenv vars just
|
||||
# like we do for loglevel/spawn-backend!
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ async def breakpoint_forever():
|
|||
await tractor.pause()
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
|
||||
async with tractor.open_nursery(
|
||||
debug_mode=True,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ async def name_error():
|
|||
getattr(doggypants) # noqa (on purpose)
|
||||
|
||||
|
||||
async def main():
|
||||
async def main() -> None:
|
||||
async with tractor.open_nursery(
|
||||
debug_mode=True,
|
||||
) as an:
|
||||
|
|
|
|||
Loading…
Reference in New Issue