mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
mypy: Remove need for cast by using ConcreteQueueWorker TypeVar.
This commit is contained in:
committed by
Tim Abbott
parent
cb8d574648
commit
e322c2161c
@@ -101,14 +101,11 @@ def check_and_send_restart_signal() -> None:
|
||||
pass
|
||||
|
||||
def retry_send_email_failures(
|
||||
func: Callable[[Any, Dict[str, Any]], None]
|
||||
func: Callable[[ConcreteQueueWorker, Dict[str, Any]], None]
|
||||
) -> Callable[['QueueProcessingWorker', Dict[str, Any]], None]:
|
||||
# If we don't use cast() and use QueueProcessingWorker instead of Any in
|
||||
# function type annotation then mypy complains.
|
||||
func = cast(Callable[[QueueProcessingWorker, Dict[str, Any]], None], func)
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(worker: 'QueueProcessingWorker', data: Dict[str, Any]) -> None:
|
||||
def wrapper(worker: ConcreteQueueWorker, data: Dict[str, Any]) -> None:
|
||||
try:
|
||||
func(worker, data)
|
||||
except (smtplib.SMTPServerDisconnected, socket.gaierror, EmailNotDeliveredException):
|
||||
|
||||
Reference in New Issue
Block a user