Skip to content

Commit 7daef61

Browse files
committed
mypy
1 parent 9c24cdc commit 7daef61

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/service-library/src/servicelib/fastapi/http_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424

2525

26-
TException = TypeVar("TException")
26+
TException = TypeVar("TException", bound=BaseException)
2727

2828
_logger = logging.getLogger(__name__)
2929

packages/service-library/src/servicelib/tracing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
from collections.abc import Iterator
12
from contextlib import contextmanager
3+
from contextvars import Token
24
from typing import TypeAlias
35

46
from opentelemetry import context as otcontext
57
from opentelemetry import trace
8+
from opentelemetry.context import Context
69
from opentelemetry.instrumentation.logging import LoggingInstrumentor
710
from settings_library.tracing import TracingSettings
811

@@ -22,8 +25,8 @@ def get_context() -> TracingContext:
2225

2326

2427
@contextmanager
25-
def use_tracing_context(context: TracingContext):
26-
token: object | None = None
28+
def use_tracing_context(context: TracingContext) -> Iterator[None]:
29+
token: Token[Context] | None = None
2730
if context is not None:
2831
token = otcontext.attach(context)
2932
try:

0 commit comments

Comments
 (0)