Skip to content

Commit

Permalink
Fixed incorrect typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Kim committed Sep 27, 2022
1 parent d3d7fb5 commit 872ff13
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ddtrace/internal/utils/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
miss = object()

T = TypeVar("T")
S = TypeVar("S")
F = Callable[[T], S]
M = Callable[[Any, T], S]
F = Callable[[T], Any]
M = Callable[[Any, T], Any]


class LFUCache(dict):
Expand All @@ -29,7 +28,7 @@ def __init__(self, maxsize=256):
self.lock = RLock()

def get(self, key, f): # type: ignore[override]
# type: (T, Callable[[T], S]) -> S
# type: (T, Callable[[T], Any]) -> Any
"""Get a value from the cache.
If the value with the given key is not in the cache, the expensive
Expand Down Expand Up @@ -69,7 +68,7 @@ def cached_wrapper(f):
cache = LFUCache(maxsize)

def cached_f(key):
# type: (Callable[[T], S]) -> S
# type: (T) -> Any
return cache.get(key, f)

cached_f.invalidate = cache.clear # type: ignore[attr-defined]
Expand Down

0 comments on commit 872ff13

Please sign in to comment.