MCPcopy Index your code
hub / github.com/google/adk-python / client_label_context

Function client_label_context

src/google/adk/utils/_client_labels_utils.py:53–68  ·  view source on GitHub ↗

Runs the operation within the context of the given client label.

(client_label: str)

Source from the content-addressed store, hash-verified

51
52@contextmanager
53def client_label_context(client_label: str) -> Iterator[None]:
54 """Runs the operation within the context of the given client label."""
55 current_client_label = _LABEL_CONTEXT.get()
56
57 if current_client_label is not None:
58 raise ValueError(
59 "Client label already exists. You can only add one client label."
60 )
61
62 token = _LABEL_CONTEXT.set(client_label)
63
64 try:
65 yield
66 finally:
67 # Restore the previous state of the context variable
68 _LABEL_CONTEXT.reset(token)
69
70
71def get_client_labels() -> List[str]:

Calls 3

getMethod · 0.45
setMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected