Skip to content

Commit e1f78a8

Browse files
committed
fix: annotate telemetry __enter__ with Self
1 parent 9cfb80b commit e1f78a8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/a2a/utils/telemetry.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ def internal_method(self):
6262
from typing import TYPE_CHECKING, Any
6363

6464

65+
try:
66+
from typing import Self
67+
except ImportError: # pragma: no cover - for Python < 3.11
68+
from typing_extensions import Self
69+
70+
6571
if TYPE_CHECKING:
6672
from opentelemetry.trace import SpanKind as SpanKindType
6773
else:
@@ -86,7 +92,7 @@ class _NoOp:
8692
def __call__(self, *args: Any, **kwargs: Any) -> Any:
8793
return self
8894

89-
def __enter__(self) -> '_NoOp':
95+
def __enter__(self) -> Self:
9096
return self
9197

9298
def __exit__(self, *args: object, **kwargs: Any) -> None:

0 commit comments

Comments
 (0)