Skip to content

Commit 3187e28

Browse files
committed
Update
[ghstack-poisoned]
2 parents 344f793 + 024aeaa commit 3187e28

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/ghstack/github.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ def get_file_contents(
131131
return base64.b64decode(content).decode("utf-8")
132132
return content
133133

134-
def post_issue_comment(
135-
self, owner: str, repo: str, number: int, body: str
136-
) -> Any:
134+
def post_issue_comment(self, owner: str, repo: str, number: int, body: str) -> Any:
137135
"""Post a comment on an issue or pull request."""
138136
return self.post(f"repos/{owner}/{repo}/issues/{number}/comments", body=body)

src/ghstack/github_fake.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,7 @@ def rest(self, method: str, path: str, **kwargs: Any) -> Any:
487487
repo = state.repository(m.group(1), m.group(2))
488488
pr = state.pull_request(repo, GitHubNumber(int(m.group(3))))
489489
return [
490-
{"user": {"login": r.user}, "state": r.state}
491-
for r in pr.reviews
490+
{"user": {"login": r.user}, "state": r.state} for r in pr.reviews
492491
]
493492

494493
# GET /repos/{owner}/{repo}/pulls/{number}/files
@@ -515,7 +514,9 @@ def rest(self, method: str, path: str, **kwargs: Any) -> Any:
515514
}
516515

517516
# GET /repos/{owner}/{repo}/commits/{ref}/check-runs
518-
if m := re.match(r"^repos/([^/]+)/([^/]+)/commits/([^/]+)/check-runs$", path):
517+
if m := re.match(
518+
r"^repos/([^/]+)/([^/]+)/commits/([^/]+)/check-runs$", path
519+
):
519520
# For the fake endpoint, we need to find the PR by head SHA
520521
# and return its check runs
521522
state = self.state
@@ -543,7 +544,9 @@ def rest(self, method: str, path: str, **kwargs: Any) -> Any:
543544
return []
544545

545546
# GET /repos/{owner}/{repo}/contents/{path}
546-
if m := re.match(r"^repos/([^/]+)/([^/]+)/contents/(.+?)(?:\?ref=(.+))?$", path):
547+
if m := re.match(
548+
r"^repos/([^/]+)/([^/]+)/contents/(.+?)(?:\?ref=(.+))?$", path
549+
):
547550
# Return a NotFoundError for the fake endpoint
548551
raise ghstack.github.NotFoundError()
549552

src/ghstack/merge_rules.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ def get_pr_approvers(self, pr_number: int) -> Set[str]:
152152
def get_pr_check_statuses(self, pr_number: int) -> Dict[str, str]:
153153
"""Get CI check statuses for a PR's head commit."""
154154
# First get the PR to find the head SHA
155-
pr_info = self.github.get(
156-
f"repos/{self.owner}/{self.repo}/pulls/{pr_number}"
157-
)
155+
pr_info = self.github.get(f"repos/{self.owner}/{self.repo}/pulls/{pr_number}")
158156
head_sha = pr_info.get("head", {}).get("sha", "")
159157
if not head_sha:
160158
return {}
@@ -212,9 +210,7 @@ def find_matching_rule(
212210
return rule
213211
return None
214212

215-
def validate_pr(
216-
self, pr_number: int, rules: List[MergeRule]
217-
) -> ValidationResult:
213+
def validate_pr(self, pr_number: int, rules: List[MergeRule]) -> ValidationResult:
218214
"""
219215
Validate a PR against the provided merge rules.
220216

0 commit comments

Comments
 (0)