Skip to content

Commit 99a2596

Browse files
committed
Fix type checking errors with type: ignore comments
- Add type: ignore[arg-type] for Union type narrowing in messages_create - Add type: ignore[return-value] for wrapper return types - Add type: ignore[return-value] for __exit__ returning None
1 parent ea0bd94 commit 99a2596

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

  • instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic

instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/patch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ def traced_method(
6969
try:
7070
result = wrapped(*args, **kwargs)
7171
if is_streaming:
72-
return StreamWrapper(result, handler, invocation)
73-
wrapper = MessageWrapper(result, handler, invocation)
72+
return StreamWrapper(result, handler, invocation) # type: ignore[arg-type]
73+
wrapper = MessageWrapper(result, handler, invocation) # type: ignore[arg-type]
7474
return wrapper.message
7575
except Exception as exc:
7676
handler.fail_llm(
7777
invocation, Error(message=str(exc), type=type(exc))
7878
)
7979
raise
8080

81-
return traced_method
81+
return traced_method # type: ignore[return-value]
8282

8383

8484
def messages_stream(
@@ -118,4 +118,4 @@ def traced_method(
118118
)
119119
raise
120120

121-
return traced_method
121+
return traced_method # type: ignore[return-value]

instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool:
335335
Error(message=str(exc_val) if exc_val else str(exc_type), type=exc_type),
336336
)
337337
# Always exit the underlying stream manager
338-
return self._stream_manager.__exit__(exc_type, exc_val, exc_tb)
338+
return self._stream_manager.__exit__(exc_type, exc_val, exc_tb) # type: ignore[return-value]
339339

340340
def _extract_telemetry_from_stream(self) -> None:
341341
"""Extract telemetry data from the MessageStream's final message."""

0 commit comments

Comments
 (0)