mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add maintainer can modify flag to create pull request (#703)
* Add flag for maintainer can modify when creating pull requests * Change default to be None to let github decide the behaviour * Update docstring * Follow conventions from other functions
This commit is contained in:
@@ -1010,19 +1010,24 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
:param issue: :class:`github.Issue.Issue`
|
||||
:param base: string
|
||||
:param head: string
|
||||
:param maintainer_can_modify: bool
|
||||
:rtype: :class:`github.PullRequest.PullRequest`
|
||||
"""
|
||||
if len(args) + len(kwds) == 4:
|
||||
if len(args) + len(kwds) >= 4:
|
||||
return self.__create_pull_1(*args, **kwds)
|
||||
else:
|
||||
return self.__create_pull_2(*args, **kwds)
|
||||
|
||||
def __create_pull_1(self, title, body, base, head):
|
||||
def __create_pull_1(self, title, body, base, head, maintainer_can_modify=github.GithubObject.NotSet):
|
||||
assert isinstance(title, (str, unicode)), title
|
||||
assert isinstance(body, (str, unicode)), body
|
||||
assert isinstance(base, (str, unicode)), base
|
||||
assert isinstance(head, (str, unicode)), head
|
||||
return self.__create_pull(title=title, body=body, base=base, head=head)
|
||||
assert maintainer_can_modify is github.GithubObject.NotSet or isinstance(maintainer_can_modify, bool), maintainer_can_modify
|
||||
if maintainer_can_modify is not github.GithubObject.NotSet:
|
||||
return self.__create_pull(title=title, body=body, base=base, head=head, maintainer_can_modify=maintainer_can_modify)
|
||||
else:
|
||||
return self.__create_pull(title=title, body=body, base=base, head=head)
|
||||
|
||||
def __create_pull_2(self, issue, base, head):
|
||||
assert isinstance(issue, github.Issue.Issue), issue
|
||||
|
||||
Reference in New Issue
Block a user