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

Function _async_sub

src/google/adk/utils/instructions_utils.py:70–79  ·  view source on GitHub ↗
(pattern, repl_async_fn, string)

Source from the content-addressed store, hash-verified

68 invocation_context = readonly_context._invocation_context
69
70 async def _async_sub(pattern, repl_async_fn, string) -> str:
71 result = []
72 last_end = 0
73 for match in re.finditer(pattern, string):
74 result.append(string[last_end : match.start()])
75 replacement = await repl_async_fn(match)
76 result.append(replacement)
77 last_end = match.end()
78 result.append(string[last_end:])
79 return ''.join(result)
80
81 async def _replace_match(match) -> str:
82 var_name = match.group().lstrip('{').rstrip('}').strip()

Callers 1

inject_session_stateFunction · 0.85

Calls 4

appendMethod · 0.45
startMethod · 0.45
endMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected