mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
mypy: Use Dict instead of Mapping in queues.
This commit is contained in:
@@ -135,7 +135,7 @@ class SimpleQueueClient(object):
|
||||
consumer_tag=self._generate_ctag(queue_name)))
|
||||
|
||||
def register_json_consumer(self, queue_name, callback):
|
||||
# type: (str, Callable[[Mapping[str, Any]], None]) -> None
|
||||
# type: (str, Callable[[Dict[str, Any]], None]) -> None
|
||||
def wrapped_callback(ch, method, properties, body):
|
||||
# type: (BlockingChannel, Basic.Deliver, pika.BasicProperties, str) -> None
|
||||
callback(ujson.loads(body))
|
||||
|
||||
@@ -108,11 +108,11 @@ class QueueProcessingWorker(object):
|
||||
raise WorkerDeclarationException("Queue worker declared without queue_name")
|
||||
|
||||
def consume(self, data):
|
||||
# type: (Mapping[str, Any]) -> None
|
||||
# type: (Dict[str, Any]) -> None
|
||||
raise WorkerDeclarationException("No consumer defined!")
|
||||
|
||||
def consume_wrapper(self, data):
|
||||
# type: (Mapping[str, Any]) -> None
|
||||
# type: (Dict[str, Any]) -> None
|
||||
try:
|
||||
self.consume(data)
|
||||
except Exception:
|
||||
@@ -246,7 +246,7 @@ class MissedMessageWorker(QueueProcessingWorker):
|
||||
@assign_queue('missedmessage_email_senders')
|
||||
class MissedMessageSendingWorker(QueueProcessingWorker):
|
||||
def consume(self, data):
|
||||
# type: (Mapping[str, Any]) -> None
|
||||
# type: (Dict[str, Any]) -> None
|
||||
try:
|
||||
send_email_from_dict(data)
|
||||
except EmailNotDeliveredException:
|
||||
|
||||
Reference in New Issue
Block a user