summaryrefslogtreecommitdiff
path: root/kombu/asynchronous/timer.py
diff options
context:
space:
mode:
authorAsif Saif Uddin <auvipy@gmail.com>2023-04-08 22:45:08 +0600
committerGitHub <noreply@github.com>2023-04-08 22:45:08 +0600
commit973dc3790ac25b9da7b6d2641ac72d95470f6ed8 (patch)
tree9e7ba02d8520994a06efc37dde05fba722138189 /kombu/asynchronous/timer.py
parent7ceb675bb69917fae182ebdaf9a2298a308c3fa4 (diff)
parent2de7f9f038dd62e097e490cb3fa609067c1c3c36 (diff)
downloadkombu-py310.tar.gz
Merge branch 'main' into py310py310
Diffstat (limited to 'kombu/asynchronous/timer.py')
-rw-r--r--kombu/asynchronous/timer.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/kombu/asynchronous/timer.py b/kombu/asynchronous/timer.py
index 21ad37c1..f6be1346 100644
--- a/kombu/asynchronous/timer.py
+++ b/kombu/asynchronous/timer.py
@@ -1,5 +1,7 @@
"""Timer scheduling Python callbacks."""
+from __future__ import annotations
+
import heapq
import sys
from collections import namedtuple
@@ -7,6 +9,7 @@ from datetime import datetime
from functools import total_ordering
from time import monotonic
from time import time as _time
+from typing import TYPE_CHECKING
from weakref import proxy as weakrefproxy
from vine.utils import wraps
@@ -18,6 +21,9 @@ try:
except ImportError: # pragma: no cover
utc = None
+if TYPE_CHECKING:
+ from types import TracebackType
+
__all__ = ('Entry', 'Timer', 'to_timestamp')
logger = get_logger(__name__)
@@ -101,7 +107,12 @@ class Timer:
def __enter__(self):
return self
- def __exit__(self, *exc_info):
+ def __exit__(
+ self,
+ exc_type: type[BaseException] | None,
+ exc_val: BaseException | None,
+ exc_tb: TracebackType | None
+ ) -> None:
self.stop()
def call_at(self, eta, fun, args=(), kwargs=None, priority=0):