MCPcopy Index your code
hub / github.com/python/mypy / wait_for_server

Function wait_for_server

mypy/dmypy/client.py:356–373  ·  view source on GitHub ↗

Wait until the server is up. Exit if it doesn't happen within the timeout.

(status_file: str, timeout: float = 5.0)

Source from the content-addressed store, hash-verified

354
355
356def wait_for_server(status_file: str, timeout: float = 5.0) -> None:
357 """Wait until the server is up.
358
359 Exit if it doesn't happen within the timeout.
360 """
361 endtime = time.time() + timeout
362 while time.time() < endtime:
363 try:
364 data = read_status(status_file)
365 except BadStatus:
366 # If the file isn't there yet, retry later.
367 time.sleep(0.1)
368 continue
369 # If the file's content is bogus or the process is dead, fail.
370 check_status(data)
371 print("Daemon started")
372 return
373 fail("Timed out waiting for daemon to start")
374
375
376@action(run_parser)

Callers 1

start_serverFunction · 0.85

Calls 4

read_statusFunction · 0.90
check_statusFunction · 0.85
printFunction · 0.85
failFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…