Correct Repository.create_pull typing harder (#1635)

It turns out if an argument is optional for an overloaded method, the
type hints require the default argument specified to successfully match
against the correct signature. Furthermore, the second kind of
create_pull() does not support the draft argument at all, so remove it.

Fixes #1634
This commit is contained in:
Steve Kowalik
2020-08-04 17:49:49 +10:00
committed by GitHub
parent 707246519e
commit 5ad091d018
+2 -2
View File
@@ -181,9 +181,9 @@ class Repository(CompletableGithubObject):
) -> Milestone: ...
def create_project(self, name: str, body: str = ...) -> Project: ...
@overload
def create_pull(self, title: str, body: str, base: str, head: str, maintainer_can_modify: Union[bool, _NotSetType], draft: bool, issue: _NotSetType) -> PullRequest: ...
def create_pull(self, title: str, body: str, base: str, head: str, maintainer_can_modify: Union[bool, _NotSetType] = _NotSetType(), draft: bool = False, issue: _NotSetType = _NotSetType()) -> PullRequest: ...
@overload
def create_pull(self, title: _NotSetType, body: _NotSetType, base: str, head: str, maintainer_can_modify: _NotSetType, draft: bool, issue: Issue) -> PullRequest: ...
def create_pull(self, title: _NotSetType, body: _NotSetType, base: str, head: str, maintainer_can_modify: _NotSetType, issue: Issue) -> PullRequest: ...
def create_repository_dispatch(
self, event_type: str, client_payload: Dict[str, str]
) -> bool: ...