mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
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:
+15
-16
@@ -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): ...
|
||||
|
||||
Reference in New Issue
Block a user