Annotate more items in pika.channel (#9385)

This commit is contained in:
Sebastian Rittau
2022-12-19 16:07:47 +01:00
committed by GitHub
parent 8ef547417f
commit f52099a22b
2 changed files with 79 additions and 54 deletions

View File

@@ -1,26 +1,30 @@
from _typeshed import Incomplete, Self
from collections.abc import Callable
from logging import Logger
from typing import Any
from typing_extensions import Final
from .callback import CallbackManager
from .connection import Connection
from .data import _ArgumentMapping
from .exchange_type import ExchangeType
from .frame import Method
from .spec import Basic, BasicProperties, Exchange
from .frame import Body, Header, Method
from .spec import Basic, BasicProperties, Confirm, Exchange, Queue, Tx
LOGGER: Incomplete
MAX_CHANNELS: int
LOGGER: Logger
MAX_CHANNELS: Final[int]
class Channel:
CLOSED: Final[int]
OPENING: Final[int]
OPEN: Final[int]
CLOSING: Final[int]
CLOSED: Final = 0
OPENING: Final = 1
OPEN: Final = 2
CLOSING: Final = 3
channel_number: int
callbacks: CallbackManager
connection: Connection
flow_active: bool
def __init__(self: Self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ...
def __int__(self) -> int: ...
def add_callback(self, callback, replies, one_shot: bool = ...) -> None: ...
@@ -28,7 +32,7 @@ class Channel:
def add_on_close_callback(self, callback) -> None: ...
def add_on_flow_callback(self, callback) -> None: ...
def add_on_return_callback(self, callback) -> None: ...
def basic_ack(self, delivery_tag: int = ..., multiple: bool = ...): ...
def basic_ack(self, delivery_tag: int = ..., multiple: bool = ...) -> None: ...
def basic_cancel(
self, consumer_tag: str = ..., callback: Callable[[Method[Basic.CancelOk]], object] | None = ...
) -> None: ...
@@ -42,23 +46,38 @@ class Channel:
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Basic.ConsumeOk]], object] | None = ...,
) -> str: ...
def basic_get(self, queue, callback, auto_ack: bool = ...) -> None: ...
def basic_nack(self, delivery_tag: int = ..., multiple: bool = ..., requeue: bool = ...): ...
def basic_get(
self, queue: str, callback: Callable[[Channel, Basic.GetOk, BasicProperties, bytes], object], auto_ack: bool = ...
) -> None: ...
def basic_nack(self, delivery_tag: int = ..., multiple: bool = ..., requeue: bool = ...) -> None: ...
def basic_publish(
self, exchange: str, routing_key: str, body: str | bytes, properties: BasicProperties | None = ..., mandatory: bool = ...
) -> None: ...
def basic_qos(
self, prefetch_size: int = ..., prefetch_count: int = ..., global_qos: bool = ..., callback: Incomplete | None = ...
): ...
def basic_reject(self, delivery_tag: int = ..., requeue: bool = ...): ...
def basic_recover(self, requeue: bool = ..., callback: Incomplete | None = ...): ...
self,
prefetch_size: int = ...,
prefetch_count: int = ...,
global_qos: bool = ...,
callback: Callable[[Method[Basic.QosOk]], object] | None = ...,
) -> None: ...
def basic_reject(self, delivery_tag: int = ..., requeue: bool = ...) -> None: ...
def basic_recover(self, requeue: bool = ..., callback: Callable[[Method[Basic.RecoverOk]], object] | None = ...) -> None: ...
def close(self, reply_code: int = ..., reply_text: str = ...) -> None: ...
def confirm_delivery(self, ack_nack_callback, callback: Incomplete | None = ...) -> None: ...
def confirm_delivery(
self,
ack_nack_callback: Callable[[Method[Basic.Ack | Basic.Nack]], object],
callback: Callable[[Method[Confirm.SelectOk]], object] | None = ...,
) -> None: ...
@property
def consumer_tags(self): ...
def consumer_tags(self) -> list[str]: ...
def exchange_bind(
self, destination, source, routing_key: str = ..., arguments: Incomplete | None = ..., callback: Incomplete | None = ...
): ...
self,
destination: str,
source: str,
routing_key: str = ...,
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Exchange.BindOk]], object] | None = ...,
) -> None: ...
def exchange_declare(
self,
exchange: str,
@@ -69,63 +88,69 @@ class Channel:
internal: bool = ...,
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Exchange.DeclareOk]], object] | None = ...,
): ...
) -> None: ...
def exchange_delete(
self,
exchange: str | None = ...,
if_unused: bool = ...,
callback: Callable[[Method[Exchange.DeleteOk]], object] | None = ...,
): ...
) -> None: ...
def exchange_unbind(
self,
destination: Incomplete | None = ...,
source: Incomplete | None = ...,
destination: str | None = ...,
source: str | None = ...,
routing_key: str = ...,
arguments: Incomplete | None = ...,
callback: Incomplete | None = ...,
): ...
def flow(self, active, callback: Incomplete | None = ...) -> None: ...
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Exchange.UnbindOk]], object] | None = ...,
) -> None: ...
def flow(self, active: bool, callback: Callable[[bool], object] | None = ...) -> None: ...
@property
def is_closed(self): ...
def is_closed(self) -> bool: ...
@property
def is_closing(self): ...
def is_closing(self) -> bool: ...
@property
def is_open(self): ...
def is_open(self) -> bool: ...
@property
def is_opening(self): ...
def is_opening(self) -> bool: ...
def open(self) -> None: ...
def queue_bind(
self,
queue,
exchange,
routing_key: Incomplete | None = ...,
arguments: Incomplete | None = ...,
callback: Incomplete | None = ...,
): ...
queue: str,
exchange: str,
routing_key: str | None = ...,
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Queue.BindOk]], object] | None = ...,
) -> None: ...
def queue_declare(
self,
queue,
queue: str,
passive: bool = ...,
durable: bool = ...,
exclusive: bool = ...,
auto_delete: bool = ...,
arguments: Incomplete | None = ...,
callback: Incomplete | None = ...,
): ...
def queue_delete(self, queue, if_unused: bool = ..., if_empty: bool = ..., callback: Incomplete | None = ...): ...
def queue_purge(self, queue, callback: Incomplete | None = ...): ...
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Queue.DeclareOk]], object] | None = ...,
) -> None: ...
def queue_delete(
self,
queue: str,
if_unused: bool = ...,
if_empty: bool = ...,
callback: Callable[[Method[Queue.DeleteOk]], object] | None = ...,
) -> None: ...
def queue_purge(self, queue: str, callback: Callable[[Method[Queue.PurgeOk]], object] | None = ...) -> None: ...
def queue_unbind(
self,
queue,
exchange: Incomplete | None = ...,
routing_key: Incomplete | None = ...,
arguments: Incomplete | None = ...,
callback: Incomplete | None = ...,
queue: str,
exchange: str | None = ...,
routing_key: str | None = ...,
arguments: _ArgumentMapping | None = ...,
callback: Callable[[Method[Queue.UnbindOk]], object] | None = ...,
): ...
def tx_commit(self, callback: Incomplete | None = ...): ...
def tx_rollback(self, callback: Incomplete | None = ...): ...
def tx_select(self, callback: Incomplete | None = ...): ...
def tx_commit(self, callback: Callable[[Method[Tx.CommitOk]], object] | None = ...) -> None: ...
def tx_rollback(self, callback: Callable[[Method[Tx.RollbackOk]], object] | None = ...) -> None: ...
def tx_select(self, callback: Callable[[Method[Tx.SelectOk]], object] | None = ...) -> None: ...
class ContentFrameAssembler:
def __init__(self) -> None: ...
def process(self, frame_value): ...
def process(self, frame_value: Method[Any] | Header | Body) -> tuple[Incomplete, Incomplete, bytes] | None: ...

View File

@@ -455,10 +455,10 @@ class Queue(Class):
class DeclareOk(Method):
INDEX: ClassVar[int]
queue: str
queue: _str
message_count: int
consumer_count: int
def __init__(self, queue: str, message_count: int, consumer_count: int) -> None: ...
def __init__(self, queue: _str, message_count: int, consumer_count: int) -> None: ...
@property
def synchronous(self) -> Literal[False]: ...
def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ...