asyncdefdeclare_queue(self,queue:"RabbitQueue",declare:bool=EMPTY,passive:Annotated[bool,deprecated("Use `declare` instead. Will be removed in the 0.6.0 release."),]=EMPTY,*,channel:Optional["Channel"]=None,)->"aio_pika.RobustQueue":"""Declare a queue."""if(q:=self.__queues.get(queue))isNone:channel_obj=awaitself.__channel_manager.get_channel(channel)ifpassiveisnotEMPTY:warnings.warn(DeprecationWarning("Use `declare` instead. Will be removed in the 0.6.0 release.",),stacklevel=2,)declare=notpassiveelifdeclareisEMPTY:declare=queue.declareself.__queues[queue]=q=cast("aio_pika.RobustQueue",awaitchannel_obj.declare_queue(name=queue.name,durable=queue.durable,exclusive=queue.exclusive,passive=notdeclare,auto_delete=queue.auto_delete,arguments=queue.arguments,timeout=queue.timeout,robust=queue.robust,),)returnq
asyncdefdeclare_exchange(self,exchange:"RabbitExchange",declare:bool=EMPTY,passive:Annotated[bool,deprecated("Use `declare` instead. Will be removed in the 0.6.0 release."),]=EMPTY,*,channel:Optional["Channel"]=None,)->"aio_pika.RobustExchange":"""Declare an exchange, parent exchanges and bind them each other."""channel_obj=awaitself.__channel_manager.get_channel(channel)ifnotexchange.name:returnchannel_obj.default_exchangeif(exch:=self.__exchanges.get(exchange))isNone:ifpassiveisnotEMPTY:warnings.warn(DeprecationWarning("Use `declare` instead. Will be removed in the 0.6.0 release.",),stacklevel=2,)declare=notpassiveelifdeclareisEMPTY:declare=exchange.declareself.__exchanges[exchange]=exch=cast("aio_pika.RobustExchange",awaitchannel_obj.declare_exchange(name=exchange.name,type=exchange.type.value,durable=exchange.durable,auto_delete=exchange.auto_delete,passive=notdeclare,arguments=exchange.arguments,timeout=exchange.timeout,robust=exchange.robust,internal=False,# deprecated RMQ option),)ifexchange.bind_toisnotNone:parent=awaitself.declare_exchange(exchange.bind_to)awaitexch.bind(exchange=parent,routing_key=exchange.routing,arguments=exchange.bind_arguments,timeout=exchange.timeout,robust=exchange.robust,)returnexch