Skip to content

Commit b7a1380

Browse files
committed
fix: update use_trace context manager to improve type hinting for trace_id
1 parent 4a9db34 commit b7a1380

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

audiostack/helpers/request_interface.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def download_url(cls, url: str, name: str, destination: str) -> None:
161161

162162
@contextlib.contextmanager
163163
def use_trace(trace_id: str) -> Generator[None, None, None]:
164-
token = _current_trace_id.set(trace_id)
164+
# This is a workaround to give correct type hints to the context manager but follow ContextVar's .set() method signature
165+
any_typed_trace_id: Any = trace_id
166+
token = _current_trace_id.set(any_typed_trace_id)
165167
try:
166168
yield
167169
finally:

0 commit comments

Comments
 (0)