Fix `LinkedTaskChannel` docstrings from GH bot review

Address valid findings from copilot's PR #413 review
(https://github.com/goodboy/tractor/pull/413
 #pullrequestreview-3925876037):

- `.get()` docstring referenced non-existent
  `._from_trio` attr, correct to `._to_aio`.
- `.send()` docstring falsely claimed error-raising
  on missing `from_trio` arg; reword to describe the
  actual `.put_nowait()` enqueue behaviour.
- `.open_channel_from()` return type annotation had
  `tuple[LinkedTaskChannel, Any]` but `yield` order
  is `(first, chan)`; fix annotation + docstring to
  match actual `tuple[Any, LinkedTaskChannel]`.

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
piker_pin_macmini
Gud Boi 2026-03-11 23:11:30 -04:00
parent 417b796169
commit e89fe03da7
1 changed files with 12 additions and 13 deletions

View File

@ -272,18 +272,16 @@ class LinkedTaskChannel(
''' '''
Receive a value `asyncio.Task` <- `trio.Task`. Receive a value `asyncio.Task` <- `trio.Task`.
This is equiv to `await self._from_trio.get()`. This is equiv to `await self._to_aio.get()`.
''' '''
return await self._to_aio.get() return await self._to_aio.get()
async def send(self, item: Any) -> None: async def send(self, item: Any) -> None:
''' '''
Send a value through `trio.Task` -> `asyncio.Task` Send a value `trio.Task` -> `asyncio.Task`
presuming by enqueuing `item` onto the internal
it defines a `from_trio` argument or makes calls `asyncio.Queue` via `put_nowait()`.
to `chan.get()` , if it does not
this method will raise an error.
''' '''
self._to_aio.put_nowait(item) self._to_aio.put_nowait(item)
@ -1301,16 +1299,17 @@ async def open_channel_from(
**target_kwargs, **target_kwargs,
) -> AsyncIterator[ ) -> AsyncIterator[
tuple[LinkedTaskChannel, Any] tuple[Any, LinkedTaskChannel]
]: ]:
''' '''
Start an `asyncio.Task` as `target()` and open an inter-loop Start an `asyncio.Task` as `target()` and open an
(linked) channel for streaming between it and the current inter-loop (linked) channel for streaming between
`trio.Task`. it and the current `trio.Task`.
A pair `(chan: LinkedTaskChannel, Any)` is delivered to the caller A pair `(Any, chan: LinkedTaskChannel)` is delivered
where the 2nd element is the value provided by the to the caller where the 1st element is the value
`asyncio.Task`'s unblocking call to `chan.started_nowait()`. provided by the `asyncio.Task`'s unblocking call
to `chan.started_nowait()`.
''' '''
chan: LinkedTaskChannel = _run_asyncio_task( chan: LinkedTaskChannel = _run_asyncio_task(