Skip to content

Commit a678789

Browse files
committed
Remove annotations from ABC methods because they look ugly in Sphinx
1 parent b93ed9e commit a678789

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

docs/source/reference-core.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ many cases, you just want to pass objects between different tasks
12211221
inside a single process, and for that you can use
12221222
:func:`trio.open_memory_channel`:
12231223

1224-
.. autofunction:: open_memory_channel
1224+
.. autofunction:: open_memory_channel(max_buffer_size)
12251225

12261226
.. note:: If you've used the :mod:`threading` or :mod:`asyncio`
12271227
modules, you may be familiar with :class:`queue.Queue` or

trio/_abc.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,18 @@ async def send_eof(self):
484484
"""
485485

486486

487-
T = TypeVar("T")
487+
# The type of object produced by a ReceiveChannel (covariant because
488+
# ReceiveChannel[Derived] can be passed to someone expecting
489+
# ReceiveChannel[Base])
488490
T_co = TypeVar("T_co", covariant=True)
491+
492+
# The type of object accepted by a SendChannel (contravariant because
493+
# SendChannel[Base] can be passed to someone expecting
494+
# SendChannel[Derived])
489495
T_contra = TypeVar("T_contra", contravariant=True)
496+
497+
# The type of object produced by a Listener (covariant plus must be
498+
# an AsyncResource)
490499
T_resource = TypeVar("T_resource", bound=AsyncResource, covariant=True)
491500

492501

@@ -542,7 +551,7 @@ class SendChannel(AsyncResource, Generic[T_contra]):
542551
__slots__ = ()
543552

544553
@abstractmethod
545-
def send_nowait(self, value: T_contra) -> None:
554+
def send_nowait(self, value):
546555
"""Attempt to send an object through the channel, without blocking.
547556
548557
Args:
@@ -560,7 +569,7 @@ def send_nowait(self, value: T_contra) -> None:
560569
"""
561570

562571
@abstractmethod
563-
async def send(self, value: T_contra) -> None:
572+
async def send(self, value):
564573
"""Attempt to send an object through the channel, blocking if necessary.
565574
566575
Args:
@@ -577,7 +586,7 @@ async def send(self, value: T_contra) -> None:
577586
"""
578587

579588
@abstractmethod
580-
def clone(self: T) -> T:
589+
def clone(self):
581590
"""Clone this send channel object.
582591
583592
This returns a new :class:`SendChannel` object, which acts as a
@@ -625,7 +634,7 @@ class ReceiveChannel(AsyncResource, Generic[T_co]):
625634
__slots__ = ()
626635

627636
@abstractmethod
628-
def receive_nowait(self) -> T_co:
637+
def receive_nowait(self):
629638
"""Attempt to receive an incoming object, without blocking.
630639
631640
Returns:
@@ -644,7 +653,7 @@ def receive_nowait(self) -> T_co:
644653
"""
645654

646655
@abstractmethod
647-
async def receive(self) -> T_co:
656+
async def receive(self):
648657
"""Attempt to receive an incoming object, blocking if necessary.
649658
650659
It's legal for multiple tasks to call :meth:`receive` at the same
@@ -665,7 +674,7 @@ async def receive(self) -> T_co:
665674
"""
666675

667676
@abstractmethod
668-
def clone(self: T) -> T:
677+
def clone(self):
669678
"""Clone this receive channel object.
670679
671680
This returns a new :class:`ReceiveChannel` object, which acts as a

0 commit comments

Comments
 (0)