INNER CODE UNIT · Python
_is_github_url
ghost-in-the-droid/android-agent · gitd/cli.py:56
def _is_github_url(target: str) -> bool:
"""Check if a string looks like a GitHub URL."""
return bool(re.match(r"(https?://)?github\.com/", target)) or target.startswith("github.com/")
def _is_local_path(target: str) -> bool:
"""Check if target is a local path."""
return target.startswith("./") or target.startswith("/") or target.startswith("../") or os.path.isdir(target)
def _normalize_github_url(url: str) -> str:
"""Ensure GitHub URL has https:// prefix."""
if not url.startswith("http"):
url = "https://" + url
# Strip trailing slashes and .git suffix for consistency
url = url.rstrip("/")
if url.endswith(".git"):
url = url[:-4]