From 8dee53a8333a3b2aafff465e063ebadc9c86933e Mon Sep 17 00:00:00 2001 From: Paul Luna Date: Wed, 6 Sep 2023 23:44:01 -0700 Subject: [PATCH] Make Branch.edit_* functions return objects (#2748) --- github/Branch.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/github/Branch.py b/github/Branch.py index 01c91e5d..e42fc6b5 100644 --- a/github/Branch.py +++ b/github/Branch.py @@ -134,7 +134,7 @@ class Branch(NonCompletableGithubObject): teams_bypass_pull_request_allowances: Opt[list[str]] = NotSet, apps_bypass_pull_request_allowances: Opt[list[str]] = NotSet, block_creations: Opt[bool] = NotSet, - ) -> None: + ) -> BranchProtection: """ :calls: `PUT /repos/{owner}/{repo}/branches/{branch}/protection `_ @@ -276,6 +276,8 @@ class Branch(NonCompletableGithubObject): input=post_parameters, ) + return github.BranchProtection.BranchProtection(self._requester, headers, data, completed=True) + def remove_protection(self) -> None: """ :calls: `DELETE /repos/{owner}/{repo}/branches/{branch}/protection `_ @@ -297,7 +299,7 @@ class Branch(NonCompletableGithubObject): self, strict: Opt[bool] = NotSet, contexts: Opt[list[str]] = NotSet, - ) -> None: + ) -> RequiredStatusChecks: """ :calls: `PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks `_ """ @@ -311,6 +313,8 @@ class Branch(NonCompletableGithubObject): input=post_parameters, ) + return github.RequiredStatusChecks.RequiredStatusChecks(self._requester, headers, data, completed=True) + def remove_required_status_checks(self) -> None: """ :calls: `DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks `_ @@ -341,7 +345,7 @@ class Branch(NonCompletableGithubObject): dismiss_stale_reviews: Opt[bool] = NotSet, require_code_owner_reviews: Opt[bool] = NotSet, required_approving_review_count: Opt[int] = NotSet, - ) -> None: + ) -> RequiredStatusChecks: """ :calls: `PATCH /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews `_ """ @@ -373,6 +377,8 @@ class Branch(NonCompletableGithubObject): input=post_parameters, ) + return github.RequiredStatusChecks.RequiredStatusChecks(self._requester, headers, data, completed=True) + def remove_required_pull_request_reviews(self) -> None: """ :calls: `DELETE /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews `_