Skip to content

Commit 9ea89e5

Browse files
Valentina Bojanclaude
andcommitted
docs/types: address review nits on ExecutionSourceContext
- drop the old-impl reference (env var) from the docstring - use modern typing hints (str | None, Token[str | None] | None) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 1d72a3b commit 9ea89e5

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

packages/uipath-platform/src/uipath/platform/common/_execution_context.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from contextvars import ContextVar, Token
22
from os import environ as env
3-
from typing import Optional
43

54
from uipath.platform.common.constants import ENV_JOB_ID, ENV_JOB_KEY, ENV_ROBOT_KEY
65

7-
_execution_source: ContextVar[Optional[str]] = ContextVar(
6+
_execution_source: ContextVar[str | None] = ContextVar(
87
"execution_source", default=None
98
)
109

@@ -13,15 +12,15 @@ class ExecutionSourceContext:
1312
"""Scope the execution source for the duration of a run.
1413
1514
Carries the source (e.g. ``runtime``/``playground``/``eval``) via a context
16-
variable instead of a process-global env var, and releases it on exit so it
17-
stays correctly scoped in concurrent runs. The CLI enters this with
18-
``UiPathRuntimeContext.execution_source`` so platform clients can read it
19-
via :attr:`UiPathExecutionContext.execution_source`.
15+
variable and releases it on exit so it stays correctly scoped in concurrent
16+
runs. The CLI enters this with ``UiPathRuntimeContext.execution_source`` so
17+
platform clients can read it via
18+
:attr:`UiPathExecutionContext.execution_source`.
2019
"""
2120

22-
def __init__(self, execution_source: Optional[str]) -> None:
21+
def __init__(self, execution_source: str | None) -> None:
2322
self._execution_source = execution_source
24-
self._token: Optional[Token[Optional[str]]] = None
23+
self._token: Token[str | None] | None = None
2524

2625
def __enter__(self) -> "ExecutionSourceContext":
2726
self._token = _execution_source.set(self._execution_source)

0 commit comments

Comments
 (0)