Skip to content

Commit

Permalink
Fix type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
WqyJh committed Apr 25, 2024
1 parent ea17a3e commit 5bff39b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions opentelemetry-api/src/opentelemetry/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
logger = logging.getLogger(__name__)


def _load_runtime_context() -> typing.Optional[_RuntimeContext]:
def _load_runtime_context() -> _RuntimeContext:
"""Initialize the RuntimeContext
Returns:
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_current() -> Context:
Returns:
The current `Context` object.
"""
return _RUNTIME_CONTEXT.get_current() # type:ignore
return _RUNTIME_CONTEXT.get_current()


def attach(context: Context) -> object:
Expand All @@ -140,7 +140,7 @@ def attach(context: Context) -> object:
Returns:
A token that can be used with `detach` to reset the context.
"""
return _RUNTIME_CONTEXT.attach(context) # type:ignore
return _RUNTIME_CONTEXT.attach(context)


def detach(token: object) -> None:
Expand All @@ -151,7 +151,7 @@ def detach(token: object) -> None:
token: The Token that was returned by a previous call to attach a Context.
"""
try:
_RUNTIME_CONTEXT.detach(token) # type: ignore
_RUNTIME_CONTEXT.detach(token)
except Exception: # pylint: disable=broad-except
logger.exception("Failed to detach context")

Expand Down

0 comments on commit 5bff39b

Please sign in to comment.