MCPcopy Create free account
hub / github.com/ezyang/ghstack / PullRequestResolved

Class PullRequestResolved

src/ghstack/diff.py:31–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30@dataclass
31class PullRequestResolved:
32 owner: str
33 repo: str
34 number: GitHubNumber
35 github_url: str
36
37 def url(self) -> str:
38 return "https://{}/{}/{}/pull/{}".format(
39 self.github_url, self.owner, self.repo, self.number
40 )
41
42 @staticmethod
43 def search(s: str, github_url: str) -> Optional["PullRequestResolved"]:
44 m = re_pull_request_resolved(github_url).search(s)
45 if m is not None:
46 return PullRequestResolved(
47 owner=m.group("owner"),
48 repo=m.group("repo"),
49 number=GitHubNumber(int(m.group("number"))),
50 github_url=github_url,
51 )
52 m = RE_GH_METADATA.search(s)
53 if m is not None:
54 return PullRequestResolved(
55 owner=m.group("owner"),
56 repo=m.group("repo"),
57 number=GitHubNumber(int(m.group("number"))),
58 github_url=github_url,
59 )
60 return None
61
62
63@dataclass

Callers 1

searchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected