mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Add missing arguments to Repository.edit (#844)
As promised in https://github.com/PyGithub/PyGithub/pull/842, here's a PR to update the `edit` method so that it allows editing the newly added properties.
This commit is contained in:
committed by
Wan Liuyang
parent
2b352fb397
commit
29d231517d
+17
-1
@@ -1194,7 +1194,7 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
self.url
|
||||
)
|
||||
|
||||
def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet, archived=github.GithubObject.NotSet):
|
||||
def edit(self, name=None, description=github.GithubObject.NotSet, homepage=github.GithubObject.NotSet, private=github.GithubObject.NotSet, has_issues=github.GithubObject.NotSet, has_projects=github.GithubObject.NotSet, has_wiki=github.GithubObject.NotSet, has_downloads=github.GithubObject.NotSet, default_branch=github.GithubObject.NotSet, allow_squash_merge=github.GithubObject.NotSet, allow_merge_commit=github.GithubObject.NotSet, allow_rebase_merge=github.GithubObject.NotSet, archived=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `PATCH /repos/:owner/:repo <http://developer.github.com/v3/repos>`_
|
||||
:param name: string
|
||||
@@ -1202,9 +1202,13 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
:param homepage: string
|
||||
:param private: bool
|
||||
:param has_issues: bool
|
||||
:param has_projects: bool
|
||||
:param has_wiki: bool
|
||||
:param has_downloads: bool
|
||||
:param default_branch: string
|
||||
:param allow_squash_merge: bool
|
||||
:param allow_merge_commit: bool
|
||||
:param allow_rebase_merge: bool
|
||||
:param archived: bool. Unarchiving repositories is currently not supported through API (https://developer.github.com/v3/repos/#edit)
|
||||
:rtype: None
|
||||
"""
|
||||
@@ -1215,9 +1219,13 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
assert homepage is github.GithubObject.NotSet or isinstance(homepage, (str, unicode)), homepage
|
||||
assert private is github.GithubObject.NotSet or isinstance(private, bool), private
|
||||
assert has_issues is github.GithubObject.NotSet or isinstance(has_issues, bool), has_issues
|
||||
assert has_projects is github.GithubObject.NotSet or isinstance(has_projects, bool), has_projects
|
||||
assert has_wiki is github.GithubObject.NotSet or isinstance(has_wiki, bool), has_wiki
|
||||
assert has_downloads is github.GithubObject.NotSet or isinstance(has_downloads, bool), has_downloads
|
||||
assert default_branch is github.GithubObject.NotSet or isinstance(default_branch, (str, unicode)), default_branch
|
||||
assert allow_squash_merge is github.GithubObject.NotSet or (isinstance(allow_squash_merge, bool) and allow_squash_merge is True), allow_squash_merge
|
||||
assert allow_merge_commit is github.GithubObject.NotSet or (isinstance(allow_merge_commit, bool) and allow_merge_commit is True), allow_merge_commit
|
||||
assert allow_rebase_merge is github.GithubObject.NotSet or (isinstance(allow_rebase_merge, bool) and allow_rebase_merge is True), allow_rebase_merge
|
||||
assert archived is github.GithubObject.NotSet or (isinstance(archived, bool) and archived is True), archived
|
||||
post_parameters = {
|
||||
"name": name,
|
||||
@@ -1230,12 +1238,20 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
post_parameters["private"] = private
|
||||
if has_issues is not github.GithubObject.NotSet:
|
||||
post_parameters["has_issues"] = has_issues
|
||||
if has_projects is not github.GithubObject.NotSet:
|
||||
post_parameters["has_projects"] = has_projects
|
||||
if has_wiki is not github.GithubObject.NotSet:
|
||||
post_parameters["has_wiki"] = has_wiki
|
||||
if has_downloads is not github.GithubObject.NotSet:
|
||||
post_parameters["has_downloads"] = has_downloads
|
||||
if default_branch is not github.GithubObject.NotSet:
|
||||
post_parameters["default_branch"] = default_branch
|
||||
if allow_squash_merge is not github.GithubObject.NotSet:
|
||||
post_parameters["allow_squash_merge"] = allow_squash_merge
|
||||
if allow_merge_commit is not github.GithubObject.NotSet:
|
||||
post_parameters["allow_merge_commit"] = allow_merge_commit
|
||||
if allow_rebase_merge is not github.GithubObject.NotSet:
|
||||
post_parameters["allow_rebase_merge"] = allow_rebase_merge
|
||||
if archived is not github.GithubObject.NotSet:
|
||||
post_parameters["archived"] = archived
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
|
||||
Reference in New Issue
Block a user