INNER CODE UNIT · Python
normalize_endpoint
cvet/fonline · BuildTools/android_device.py:111
def normalize_endpoint(value: str) -> str:
endpoint = value.strip()
if not endpoint:
raise SystemExit('Android device endpoint is empty')
if endpoint.count(':') == 0:
return endpoint + ':5555'
return endpoint
def split_endpoint(endpoint: str) -> tuple[str, int]:
normalized_endpoint = normalize_endpoint(endpoint)
host, separator, port_text = normalized_endpoint.rpartition(':')
if not separator or not host or not port_text.isdigit():
raise SystemExit(f'Invalid Android device endpoint: {endpoint}')
return host, int(port_text)
def detect_host_ip_for_endpoint(endpoint: str) -> str: