Skip to content

Commit c281314

Browse files
authored
Merge pull request #661 from snosratiershad/docs/readme-add-type-annotation-to-connection-consumer
readme: add type annotation to connection in consumer and correct in publisher example
2 parents 14a7824 + c6c382c commit c281314

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Simple consumer:
8686
# Connecting with the given parameters is also possible.
8787
# aio_pika.connect_robust(host="host", login="login", password="password")
8888
# You can only choose one option to create a connection, url or kw-based params.
89-
connection = await aio_pika.connect_robust(
89+
connection: aio_pika.abc.AbstractRobustConnection = await aio_pika.connect_robust(
9090
"amqp://guest:[email protected]/", loop=loop
9191
)
9292
@@ -128,7 +128,7 @@ Simple publisher:
128128
129129
async def main(loop):
130130
# Explicit type annotation
131-
connection: aio_pika.RobustConnection = await aio_pika.connect_robust(
131+
connection: aio_pika.abc.AbstractRobustConnection = await aio_pika.connect_robust(
132132
"amqp://guest:[email protected]/", loop=loop
133133
)
134134
@@ -157,11 +157,12 @@ Get single message example:
157157
.. code-block:: python
158158
159159
import asyncio
160+
import aio_pika.abc
160161
from aio_pika import connect_robust, Message
161162
162163
163164
async def main(loop):
164-
connection = await connect_robust(
165+
connection: aio_pika.abc.AbstractRobustConnection = await connect_robust(
165166
"amqp://guest:[email protected]/",
166167
loop=loop
167168
)

0 commit comments

Comments
 (0)