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
+15 -16
View File
@@ -1,6 +1,14 @@
from typing import Any, Dict, List, Optional, Tuple, Type, Union
class BadAttributeException:
class GithubException(Exception):
def __init__(self, status: Union[int, str], data: Any,) -> None: ...
def __str__(self) -> str: ...
@property
def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ...
@property
def status(self) -> int: ...
class BadAttributeException(GithubException):
def __init__(
self,
actualValue: Any,
@@ -26,18 +34,9 @@ class BadAttributeException:
@property
def transformation_exception(self) -> Optional[ValueError]: ...
class GithubException:
def __init__(self, status: Union[int, str], data: Any,) -> None: ...
def __str__(self) -> str: ...
@property
def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ...
@property
def status(self) -> int: ...
class IncompletableObject:
def __init__(self, status: Union[int, str], data: Any,) -> None: ...
def __str__(self) -> str: ...
@property
def data(self) -> Dict[str, Union[str, List[str], List[Dict[str, str]]]]: ...
@property
def status(self) -> int: ...
class BadCredentialsException(GithubException): ...
class UnknownObjectException(GithubException): ...
class BadUserAgentException(GithubException): ...
class RateLimitExceededException(GithubException): ...
class TwoFactorException(GithubException): ...
class IncompletableObject(GithubException): ...