INNER CODE UNIT · Python

_resolve_ref_sha

dotnet/sdk · .github/scripts/check_vendored_files.py:219

def _resolve_ref_sha(repo: str, ref: str) -> str | None:
    status, data = api_json(f"/repos/{repo}/commits/{urllib.parse.quote(ref, safe='/')}")
    if status == 200 and isinstance(data, dict):
        return data.get("sha")
    return None


def _get_blob_sha(repo: str, ref: str, path: str) -> tuple[int, str | None]:
    status, data = api_json(
        f"/repos/{repo}/contents/{urllib.parse.quote(path)}?ref={urllib.parse.quote(ref, safe='/')}"
    )
    if status == 200 and isinstance(data, dict) and data.get("type") == "file":
        return status, data.get("sha")
    return status, None


def _truncate_diff(diff_lines: list[str], max_lines: int) -> str:
    if len(diff_lines) <= max_lines:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…