Improve type stubs (#1489)

* Add type stubs for GithubException subclasses

* Install type stubs per PEP 561

See https://mypy.readthedocs.io/en/stable/installed_packages.html#making-pep-561-compatible-packages.

* Make PaginatedList a generic type

* Add type stubs for __init__.py

* Add type stub for NamedUser.get_projects

* Add GithubObject superclasses to type stubs

Fixes #1490
This commit is contained in:
Emily
2020-05-01 12:00:00 +10:00
committed by GitHub
parent 1c1cbb49c6
commit 6eba4506d4
93 changed files with 443 additions and 274 deletions
+17 -17
View File
@@ -8,22 +8,6 @@ from github.Organization import Organization
from github.PullRequestReview import PullRequestReview
from github.Requester import Requester
class CompletableGithubObject:
def __eq__(self, other: Any) -> bool: ...
def __init__(
self,
requester: Requester,
headers: Dict[str, Union[str, int]],
attributes: Dict[str, Any],
completed: bool,
) -> None: ...
def __ne__(self, other: Any) -> bool: ...
def _completeIfNeeded(self) -> None: ...
def _completeIfNotSet(
self, value: Union[_ValuedAttribute, _BadAttribute, _NotSetType]
) -> None: ...
def update(self) -> bool: ...
class GithubObject:
def __init__(
self,
@@ -107,9 +91,25 @@ class GithubObject:
@classmethod
def setCheckAfterInitFlag(cls, flag: bool) -> None: ...
class NonCompletableGithubObject:
class NonCompletableGithubObject(GithubObject):
def _completeIfNeeded(self) -> None: ...
class CompletableGithubObject(GithubObject):
def __eq__(self, other: Any) -> bool: ...
def __init__(
self,
requester: Requester,
headers: Dict[str, Union[str, int]],
attributes: Dict[str, Any],
completed: bool,
) -> None: ...
def __ne__(self, other: Any) -> bool: ...
def _completeIfNeeded(self) -> None: ...
def _completeIfNotSet(
self, value: Union[_ValuedAttribute, _BadAttribute, _NotSetType]
) -> None: ...
def update(self) -> bool: ...
class _BadAttribute:
def __init__(
self, value: Any, expectedType: Any, exception: Optional[ValueError] = ...