Skip to content

Commit 4ef711e

Browse files
committed
code-block for consistency with others
1 parent 0e8ce5d commit 4ef711e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/subscriptions.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ As of v7.7.0, web3.py includes some additional convenient subscription managemen
4949
1.) The subscription_manager
5050
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5151

52-
First, your w3 instance now includes a new module, subscription_manager. While you may still use the w3.eth.subscribe method from the previous example, the subscription_manager offers an additional way to start one or more subscriptions. We're going to pass in a list of events we want to subscribe to within the w3.subscription_manager.subscribe method.
52+
First, your ``w3`` (``AsyncWeb3``) instance now includes a new module, ``subscription_manager``. While you may still use the ``w3.eth.subscribe`` method from the previous example, the ``subscription_manager`` offers an additional way to start one or more subscriptions. We're going to pass in a list of events we want to subscribe to within the ``w3.subscription_manager.subscribe`` method.
5353

5454
.. code-block:: python
5555
@@ -59,7 +59,7 @@ First, your w3 instance now includes a new module, subscription_manager. While y
5959
2.) Subscription types
6060
~~~~~~~~~~~~~~~~~~~~~~
6161

62-
To aid in defining those subscriptions, subscription type classes have been introduced: NewHeadsSubscription, PendingTxSubscription, LogsSubscription, and SyncingSubscription. Each class is context aware, meaning it will throw an error if you provide an unexpected data type.
62+
To aid in defining those subscriptions, subscription type classes have been introduced: ``NewHeadsSubscription``, ``PendingTxSubscription``, ``LogsSubscription``, and ``SyncingSubscription``. Each class is context aware, meaning it will throw an error if you provide an unexpected data type.
6363

6464
.. code-block:: python
6565
@@ -94,7 +94,7 @@ To aid in defining those subscriptions, subscription type classes have been intr
9494
~~~~~~~~~~~~
9595

9696
In the example above, there is a handler specified for each subscription. These are context-aware functions that you can declare separate from the subscription logic. Within each handler, parse and perform whatever logic you require.
97-
Note that in addition to the result being processed, the handler_context in each handler provides access to your async_w3 instance, the subscription instance, and any custom values declared within the handler_context of the subscription. from web3.utils.subscriptions import LogsSubscriptionContext
97+
Note that in addition to the result being processed, the ``handler_context`` in each handler provides access to your ``AsyncWeb3`` instance, the subscription instance, and any custom values declared within the ``handler_context`` of the subscription: ``from web3.utils.subscriptions import LogsSubscriptionContext``
9898

9999
.. code-block:: python
100100
@@ -136,10 +136,10 @@ Finally, when all your subscriptions are configured, utilize the handle_subscrip
136136
5.) Unsubscribing
137137
~~~~~~~~~~~~~~~~~
138138

139-
If you don't want to subscribe indefinitely to an event, you can unsubscribe at any point. The first example in this post demonstrated the manual approach:await w3.eth.unsubscribe(subscription_id)
139+
If you don't want to subscribe indefinitely to an event, you can unsubscribe at any point. The first example in this post demonstrated the manual approach: ``await w3.eth.unsubscribe(subscription_id)``
140140

141141

142-
The new handler pattern will keep track of the subscription ID for you however, so the same can be accomplished via the handler_context without an ID:
142+
The new handler pattern will keep track of the subscription ID for you however, so the same can be accomplished via the ``handler_context`` without an ID:
143143

144144
.. code-block:: python
145145
@@ -149,7 +149,7 @@ The new handler pattern will keep track of the subscription ID for you however,
149149
await handler_context.subscription.unsubscribe()
150150
151151
152-
Lastly, if you're wrapping up the whole show, you can reach for unsubscribe_all on the subscription_manager:
152+
Lastly, if you're wrapping up the whole show, you can reach for ``unsubscribe_all`` on the subscription_manager:
153153

154154
.. code-block:: python
155155
@@ -222,7 +222,7 @@ FAQ
222222
How can I subscribe to additional events once my application is running?
223223
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224224

225-
Wherever you have an instance of the ``w3`` object, you can use the ``subscription_manager`` to subscribe to new events.
225+
Wherever you have a ``w3`` instance of the ``AsyncWeb3`` object, you can use the ``subscription_manager`` to subscribe to new events.
226226

227227
For example, the handler of one subscription could initialize a new subscription:
228228

0 commit comments

Comments
 (0)