MCPcopy Create free account
hub / github.com/base/base / parse_pr_spec

Function parse_pr_spec

etc/scripts/local/reth_release.py:63–74  ·  view source on GitHub ↗

Parse a PR number, and the repo when the spec is a GitHub pull URL.

(spec: str)

Source from the content-addressed store, hash-verified

61
62
63def parse_pr_spec(spec: str) -> PrSpec:
64 """Parse a PR number, and the repo when the spec is a GitHub pull URL."""
65 match = PR_SPEC_RE.fullmatch(spec.strip())
66 if match is None:
67 raise ReleaseError(
68 f"invalid PR spec {spec!r}; use a number on --upstream-repo "
69 "or a GitHub pull URL on that repo or --fork"
70 )
71 owner = match.group("owner")
72 name = match.group("name")
73 repo = f"{owner}/{name}" if owner and name else None
74 return PrSpec(number=int(match.group("num")), repo=repo)
75
76
77def resolve_pr_repo(spec: PrSpec, *, upstream_url: str, fork_url: str) -> str:

Calls 2

ReleaseErrorClass · 0.85
PrSpecClass · 0.85