Skip to content

Commit

Permalink
Merge pull request #42 from smagafurov/master
Browse files Browse the repository at this point in the history
correct return type hinting for channel, exchange, queue
  • Loading branch information
mosquito committed Jul 6, 2017
2 parents 0efc412 + 7c0fb5d commit 969f796
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions aio_pika/channel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import asyncio
from typing import Callable, Any, Union
from typing import Callable, Any, Generator, Union

import pika.channel
from logging import getLogger
Expand Down Expand Up @@ -137,7 +137,8 @@ def _on_delivery_confirmation(self, method_frame):
@asyncio.coroutine
def declare_exchange(self, name: str, type: ExchangeType = ExchangeType.DIRECT,
durable: bool = None, auto_delete: bool = False,
internal: bool = False, arguments: dict = None, timeout: int = None) -> Exchange:
internal: bool = False, arguments: dict = None, timeout: int = None
) -> Generator[Any, None, Exchange]:

with (yield from self.__write_lock):
if auto_delete and durable is None:
Expand Down Expand Up @@ -188,7 +189,8 @@ def _publish(self, queue_name, routing_key, body, properties, mandatory, immedia
@BaseChannel._ensure_channel_is_open
@asyncio.coroutine
def declare_queue(self, name: str = None, *, durable: bool = None, exclusive: bool = False, passive: bool = False,
auto_delete: bool = False, arguments: dict = None, timeout: int = None) -> Queue:
auto_delete: bool = False, arguments: dict = None, timeout: int = None
) -> Generator[Any, None, Queue]:
"""
:param name: queue name
Expand Down
2 changes: 1 addition & 1 deletion aio_pika/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _on_connection_lost(_, code, reason):

@_ensure_connection
@asyncio.coroutine
def channel(self) -> Channel:
def channel(self) -> Generator[Any, None, Channel]:
""" Get a channel """
with (yield from self.__write_lock):
log.debug("Creating AMQP channel for conneciton: %r", self)
Expand Down

0 comments on commit 969f796

Please sign in to comment.