Skip to content

Commit

Permalink
Remove annotations from ABC methods because they look ugly in Sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
oremanj committed Feb 5, 2019
1 parent b93ed9e commit a678789
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/source/reference-core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ many cases, you just want to pass objects between different tasks
inside a single process, and for that you can use
:func:`trio.open_memory_channel`:

.. autofunction:: open_memory_channel
.. autofunction:: open_memory_channel(max_buffer_size)

.. note:: If you've used the :mod:`threading` or :mod:`asyncio`
modules, you may be familiar with :class:`queue.Queue` or
Expand Down
23 changes: 16 additions & 7 deletions trio/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,18 @@ async def send_eof(self):
"""


T = TypeVar("T")
# The type of object produced by a ReceiveChannel (covariant because
# ReceiveChannel[Derived] can be passed to someone expecting
# ReceiveChannel[Base])
T_co = TypeVar("T_co", covariant=True)

# The type of object accepted by a SendChannel (contravariant because
# SendChannel[Base] can be passed to someone expecting
# SendChannel[Derived])
T_contra = TypeVar("T_contra", contravariant=True)

# The type of object produced by a Listener (covariant plus must be
# an AsyncResource)
T_resource = TypeVar("T_resource", bound=AsyncResource, covariant=True)


Expand Down Expand Up @@ -542,7 +551,7 @@ class SendChannel(AsyncResource, Generic[T_contra]):
__slots__ = ()

@abstractmethod
def send_nowait(self, value: T_contra) -> None:
def send_nowait(self, value):
"""Attempt to send an object through the channel, without blocking.
Args:
Expand All @@ -560,7 +569,7 @@ def send_nowait(self, value: T_contra) -> None:
"""

@abstractmethod
async def send(self, value: T_contra) -> None:
async def send(self, value):
"""Attempt to send an object through the channel, blocking if necessary.
Args:
Expand All @@ -577,7 +586,7 @@ async def send(self, value: T_contra) -> None:
"""

@abstractmethod
def clone(self: T) -> T:
def clone(self):
"""Clone this send channel object.
This returns a new :class:`SendChannel` object, which acts as a
Expand Down Expand Up @@ -625,7 +634,7 @@ class ReceiveChannel(AsyncResource, Generic[T_co]):
__slots__ = ()

@abstractmethod
def receive_nowait(self) -> T_co:
def receive_nowait(self):
"""Attempt to receive an incoming object, without blocking.
Returns:
Expand All @@ -644,7 +653,7 @@ def receive_nowait(self) -> T_co:
"""

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

@abstractmethod
def clone(self: T) -> T:
def clone(self):
"""Clone this receive channel object.
This returns a new :class:`ReceiveChannel` object, which acts as a
Expand Down

0 comments on commit a678789

Please sign in to comment.