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

Function _parse_timeout

src/google/adk/cli/cli.py:534–543  ·  view source on GitHub ↗

Parses a timeout string like '30s', '5m' into seconds.

(timeout_str: str)

Source from the content-addressed store, hash-verified

532
533
534def _parse_timeout(timeout_str: str) -> float:
535 """Parses a timeout string like '30s', '5m' into seconds."""
536 match = re.match(r'^(\d+)([sm])?$', timeout_str)
537 if not match:
538 raise ValueError(f'Invalid timeout format: {timeout_str}')
539 val, unit = match.groups()
540 seconds = float(val)
541 if unit == 'm':
542 seconds *= 60
543 return seconds
544
545
546async def run_once_cli(

Callers 2

run_interactivelyFunction · 0.85
run_once_cliFunction · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected