Skip to content

Commit

Permalink
Extend type forwarding to other context managers (#903)
Browse files Browse the repository at this point in the history
Signed-off-by: Crutcher Dunnavant <crutcher@openai.com>
  • Loading branch information
crutcher committed Mar 21, 2023
1 parent 30f8319 commit c48e26e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prometheus_client/context_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __enter__(self):
def __exit__(self, typ, value, traceback):
self._gauge.dec()

def __call__(self, f):
def __call__(self, f: "F") -> "F":
def wrapped(func, *args, **kwargs):
with self:
return func(*args, **kwargs)
Expand Down Expand Up @@ -75,7 +75,7 @@ def __exit__(self, typ, value, traceback):
def labels(self, *args, **kw):
self._metric = self._metric.labels(*args, **kw)

def __call__(self, f):
def __call__(self, f: "F") -> "F":
def wrapped(func, *args, **kwargs):
# Obtaining new instance of timer every time
# ensures thread safety and reentrancy.
Expand Down

0 comments on commit c48e26e

Please sign in to comment.