MCPcopy Index your code
hub / github.com/python/cpython / list_devices

Function list_devices

Android/android.py:461–481  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459# Return a list of the serial numbers of connected devices. Emulators will have
460# serials of the form "emulator-5678".
461async def list_devices():
462 serials = []
463 header_found = False
464
465 lines = (await async_check_output(adb, "devices")).splitlines()
466 for line in lines:
467 # Ignore blank lines, and all lines before the header.
468 line = line.strip()
469 if line == "List of devices attached":
470 header_found = True
471 elif header_found and line:
472 try:
473 serial, status = line.split()
474 except ValueError:
475 raise ValueError(f"failed to parse {line!r}")
476 if status == "device":
477 serials.append(serial)
478
479 if not header_found:
480 raise ValueError(f"failed to parse {lines}")
481 return serials
482
483
484async def find_device(context, initial_devices):

Callers 2

find_deviceFunction · 0.85
run_testbedFunction · 0.85

Calls 5

async_check_outputFunction · 0.85
splitlinesMethod · 0.45
stripMethod · 0.45
splitMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…