Skip to content

Commit

Permalink
Merge pull request #1242 from kendas/doc-improvements
Browse files Browse the repository at this point in the history
Small improvements in documentation formatting.
  • Loading branch information
michaelklishin committed Sep 14, 2019
2 parents 22ed99b + bec110e commit 305c4f1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
50 changes: 24 additions & 26 deletions pika/adapters/blocking_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,10 @@ def add_callback_threadsafe(self, callback):
For example, a thread may request a call to the
`BlockingChannel.basic_ack` method of a `BlockingConnection` that is
running in a different thread via
running in a different thread via::
```
connection.add_callback_threadsafe(
functools.partial(channel.basic_ack, delivery_tag=...))
```
connection.add_callback_threadsafe(
functools.partial(channel.basic_ack, delivery_tag=...))
NOTE: if you know that the requester is running on the same thread as
the connection it is more efficient to use the
Expand Down Expand Up @@ -1002,10 +1000,10 @@ def __init__(self, callback, channel, method, properties, body):
"""
:param callable callback: user's callback, having the signature
callback(channel, method, properties, body), where
channel: pika.Channel
method: pika.spec.Basic.Return
properties: pika.spec.BasicProperties
body: bytes
- channel: pika.Channel
- method: pika.spec.Basic.Return
- properties: pika.spec.BasicProperties
- body: bytes
:param pika.Channel channel:
:param pika.spec.Basic.Return method:
:param pika.spec.BasicProperties properties:
Expand Down Expand Up @@ -1071,10 +1069,10 @@ def __init__(self,
:param callable on_message_callback: The function for dispatching messages to
user, having the signature:
on_message_callback(channel, method, properties, body)
channel: BlockingChannel
method: spec.Basic.Deliver
properties: spec.BasicProperties
body: bytes
- channel: BlockingChannel
- method: spec.Basic.Deliver
- properties: spec.BasicProperties
- body: bytes
:param callable alternate_event_sink: if specified, _ConsumerDeliveryEvt
and _ConsumerCancellationEvt objects will be diverted to this
callback instead of being deposited in the channel's
Expand Down Expand Up @@ -1569,10 +1567,10 @@ def add_on_return_callback(self, callback):
:param callable callback: The method to call on callback with the
signature callback(channel, method, properties, body), where
channel: pika.Channel
method: pika.spec.Basic.Return
properties: pika.spec.BasicProperties
body: bytes
- channel: pika.Channel
- method: pika.spec.Basic.Return
- properties: pika.spec.BasicProperties
- body: bytes
"""
self._impl.add_on_return_callback(
Expand Down Expand Up @@ -1605,10 +1603,10 @@ def basic_consume(self,
:param callable on_message_callback: Required function for dispatching messages
to user, having the signature:
on_message_callback(channel, method, properties, body)
channel: BlockingChannel
method: spec.Basic.Deliver
properties: spec.BasicProperties
body: bytes
- channel: BlockingChannel
- method: spec.Basic.Deliver
- properties: spec.BasicProperties
- body: bytes
:param bool auto_ack: if set to True, automatic acknowledgement mode will be used
(see http://www.rabbitmq.com/confirms.html). This corresponds
with the 'no_ack' parameter in the basic.consume AMQP 0.9.1
Expand Down Expand Up @@ -1733,10 +1731,10 @@ def basic_cancel(self, consumer_tag):
the cancellation (this is done instead of via consumer's callback in
order to prevent reentrancy/recursion. Each message is four-tuple:
(channel, method, properties, body)
channel: BlockingChannel
method: spec.Basic.Deliver
properties: spec.BasicProperties
body: bytes
- channel: BlockingChannel
- method: spec.Basic.Deliver
- properties: spec.BasicProperties
- body: bytes
:rtype: list
"""
try:
Expand Down Expand Up @@ -1891,7 +1889,7 @@ def consume(self,
broker.
Example:
::
for method, properties, body in channel.consume('queue'):
print body
channel.basic_ack(method.delivery_tag)
Expand Down
8 changes: 4 additions & 4 deletions pika/adapters/twisted_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@ def basic_get(self, queue, auto_ack=False):
for this channel.
:param bool auto_ack: Tell the broker to not expect a reply
:returns: Deferred that fires with a namedtuple whose attributes are:
channel: this TwistedChannel
method: pika.spec.Basic.GetOk
properties: pika.spec.BasicProperties
body: bytes
- channel: this TwistedChannel
- method: pika.spec.Basic.GetOk
- properties: pika.spec.BasicProperties
- body: bytes
If the queue is empty, None will be returned.
:rtype: Deferred
:raises pika.exceptions.DuplicateGetOkCallback:
Expand Down
24 changes: 12 additions & 12 deletions pika/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ def add_on_return_callback(self, callback):
:param callable callback: The function to call, having the signature
callback(channel, method, properties, body)
where
channel: pika.Channel
method: pika.spec.Basic.Return
properties: pika.spec.BasicProperties
body: bytes
- channel: pika.Channel
- method: pika.spec.Basic.Return
- properties: pika.spec.BasicProperties
- body: bytes
"""
self.callbacks.add(self.channel_number, '_on_return', callback, False)
Expand Down Expand Up @@ -282,10 +282,10 @@ def basic_consume(self,
:param callable on_message_callback: The function to call when
consuming with the signature
on_message_callback(channel, method, properties, body), where
channel: pika.Channel
method: pika.spec.Basic.Deliver
properties: pika.spec.BasicProperties
body: bytes
- channel: pika.Channel
- method: pika.spec.Basic.Deliver
- properties: pika.spec.BasicProperties
- body: bytes
:param bool auto_ack: if set to True, automatic acknowledgement mode
will be used (see http://www.rabbitmq.com/confirms.html).
This corresponds with the 'no_ack' parameter in the basic.consume
Expand Down Expand Up @@ -357,10 +357,10 @@ def basic_get(self, queue, callback, auto_ack=False):
channel
:param callable callback: The callback to call with a message that has
the signature callback(channel, method, properties, body), where:
channel: pika.Channel
method: pika.spec.Basic.GetOk
properties: pika.spec.BasicProperties
body: bytes
- channel: pika.Channel
- method: pika.spec.Basic.GetOk
- properties: pika.spec.BasicProperties
- body: bytes
:param bool auto_ack: Tell the broker to not expect a reply
:raises ValueError:
Expand Down

0 comments on commit 305c4f1

Please sign in to comment.