|
1 | | -class AMQP: ... |
| 1 | +from datetime import datetime |
| 2 | +from typing import Any, NamedTuple, TypeAlias |
| 3 | + |
| 4 | +import kombu |
| 5 | +import kombu.pools |
| 6 | +from celery.app.base import Celery |
| 7 | +from celery.app.routes import Router as RouterClass |
| 8 | +from kombu.transport.base import StdChannel |
| 9 | + |
| 10 | +__all__ = ("AMQP", "Queues", "task_message") |
| 11 | + |
| 12 | +class task_message(NamedTuple): |
| 13 | + headers: dict[str, Any] |
| 14 | + properties: dict[str, Any] |
| 15 | + body: tuple[Any, ...] |
| 16 | + sent_event: dict[str, Any] | None |
| 17 | + |
| 18 | +class Queues(dict[str, kombu.Queue]): |
| 19 | + def __init__( |
| 20 | + self, |
| 21 | + queues: list[kombu.Queue] | dict[str, kombu.Queue] | None = None, |
| 22 | + default_exchange: kombu.Exchange | None = None, |
| 23 | + create_missing: bool = True, |
| 24 | + create_missing_queue_type: str | None = None, |
| 25 | + create_missing_queue_exchange_type: str | None = None, |
| 26 | + autoexchange: kombu.Exchange | None = None, |
| 27 | + max_priority: int | None = None, |
| 28 | + default_routing_key: str | None = None, |
| 29 | + ) -> None: ... |
| 30 | + def __missing__(self, name: str) -> kombu.Queue: ... |
| 31 | + def add(self, queue: kombu.Queue, **kwargs: Any) -> None: ... |
| 32 | + def add_compat(self, name: str, **options: Any) -> kombu.Queue: ... |
| 33 | + @property |
| 34 | + def consume_from(self) -> dict[str, kombu.Queue]: ... |
| 35 | + def deselect(self, exclude: list[str]) -> None: ... |
| 36 | + def format(self, indent: int = 0, indent_first: bool = True) -> str: ... |
| 37 | + def new_missing(self, name: str) -> kombu.Queue: ... |
| 38 | + def select(self, include: list[str]) -> None: ... |
| 39 | + def select_add(self, queue: kombu.Queue, **kwargs: Any) -> None: ... |
| 40 | + |
| 41 | +# Type alias to avoid conflict with AMQP.Queues method |
| 42 | +_Queues: TypeAlias = Queues |
| 43 | + |
| 44 | +class AMQP: |
| 45 | + # Class attributes |
| 46 | + BrokerConnection: type[kombu.Connection] |
| 47 | + Connection: type[kombu.Connection] |
| 48 | + Consumer: type[kombu.Consumer] |
| 49 | + Producer: type[kombu.Producer] |
| 50 | + queues_cls: type[_Queues] |
| 51 | + argsrepr_maxsize: int |
| 52 | + kwargsrepr_maxsize: int |
| 53 | + autoexchange: kombu.Exchange | None |
| 54 | + |
| 55 | + app: Celery |
| 56 | + |
| 57 | + def __init__(self, app: Celery) -> None: ... |
| 58 | + def TaskConsumer( |
| 59 | + self, |
| 60 | + channel: StdChannel, |
| 61 | + queues: list[kombu.Queue] | None = None, |
| 62 | + accept: list[str] | None = None, |
| 63 | + **kw: Any, |
| 64 | + ) -> kombu.Consumer: ... |
| 65 | + def Queues( |
| 66 | + self, |
| 67 | + queues: list[kombu.Queue] | dict[str, kombu.Queue], |
| 68 | + create_missing: bool | None = None, |
| 69 | + create_missing_queue_type: str | None = None, |
| 70 | + create_missing_queue_exchange_type: str | None = None, |
| 71 | + autoexchange: kombu.Exchange | None = None, |
| 72 | + max_priority: int | None = None, |
| 73 | + ) -> _Queues: ... |
| 74 | + def Router( |
| 75 | + self, |
| 76 | + queues: _Queues | None = None, |
| 77 | + create_missing: bool | None = None, |
| 78 | + ) -> RouterClass: ... |
| 79 | + def flush_routes(self) -> None: ... |
| 80 | + def as_task_v1( |
| 81 | + self, |
| 82 | + task_id: str, |
| 83 | + name: str, |
| 84 | + args: tuple[Any, ...] | None = None, |
| 85 | + kwargs: dict[str, Any] | None = None, |
| 86 | + countdown: float | None = None, |
| 87 | + eta: datetime | None = None, |
| 88 | + group_id: str | None = None, |
| 89 | + group_index: int | None = None, |
| 90 | + expires: float | datetime | None = None, |
| 91 | + retries: int = 0, |
| 92 | + chord: Any | None = None, |
| 93 | + callbacks: list[Any] | None = None, |
| 94 | + errbacks: list[Any] | None = None, |
| 95 | + reply_to: str | None = None, |
| 96 | + time_limit: int | None = None, |
| 97 | + soft_time_limit: int | None = None, |
| 98 | + create_sent_event: bool = False, |
| 99 | + root_id: str | None = None, |
| 100 | + parent_id: str | None = None, |
| 101 | + shadow: str | None = None, |
| 102 | + now: datetime | None = None, |
| 103 | + timezone: Any | None = None, |
| 104 | + **compat_kwargs: Any, |
| 105 | + ) -> task_message: ... |
| 106 | + def as_task_v2( |
| 107 | + self, |
| 108 | + task_id: str, |
| 109 | + name: str, |
| 110 | + args: tuple[Any, ...] | None = None, |
| 111 | + kwargs: dict[str, Any] | None = None, |
| 112 | + countdown: float | None = None, |
| 113 | + eta: datetime | None = None, |
| 114 | + group_id: str | None = None, |
| 115 | + group_index: int | None = None, |
| 116 | + expires: float | datetime | None = None, |
| 117 | + retries: int = 0, |
| 118 | + chord: Any | None = None, |
| 119 | + callbacks: list[Any] | None = None, |
| 120 | + errbacks: list[Any] | None = None, |
| 121 | + reply_to: str | None = None, |
| 122 | + time_limit: int | None = None, |
| 123 | + soft_time_limit: int | None = None, |
| 124 | + create_sent_event: bool = False, |
| 125 | + root_id: str | None = None, |
| 126 | + parent_id: str | None = None, |
| 127 | + shadow: str | None = None, |
| 128 | + chain: Any | None = None, |
| 129 | + now: datetime | None = None, |
| 130 | + timezone: Any | None = None, |
| 131 | + origin: str | None = None, |
| 132 | + ignore_result: bool = False, |
| 133 | + argsrepr: str | None = None, |
| 134 | + kwargsrepr: str | None = None, |
| 135 | + stamped_headers: list[str] | None = None, |
| 136 | + replaced_task_nesting: int = 0, |
| 137 | + **options: Any, |
| 138 | + ) -> task_message: ... |
| 139 | + @property |
| 140 | + def create_task_message(self) -> Any: ... |
| 141 | + @property |
| 142 | + def default_exchange(self) -> kombu.Exchange: ... |
| 143 | + @property |
| 144 | + def default_queue(self) -> kombu.Queue: ... |
| 145 | + @property |
| 146 | + def producer_pool(self) -> kombu.pools.ProducerPool: ... |
| 147 | + @property |
| 148 | + def publisher_pool(self) -> kombu.pools.ProducerPool: ... |
| 149 | + @property |
| 150 | + def queues(self) -> _Queues: ... |
| 151 | + @property |
| 152 | + def router(self) -> RouterClass: ... |
| 153 | + @property |
| 154 | + def routes(self) -> list[dict[str, Any]]: ... |
| 155 | + @property |
| 156 | + def send_task_message(self) -> Any: ... |
| 157 | + @property |
| 158 | + def utc(self) -> bool: ... |
0 commit comments