mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
* 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
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
from typing import Any, Dict, Generic, Iterator, List, Optional, Type, TypeVar, Union
|
|
|
|
from github.ContentFile import ContentFile
|
|
from github.GithubObject import GithubObject
|
|
from github.Issue import Issue
|
|
from github.NamedUser import NamedUser
|
|
from github.Requester import Requester
|
|
|
|
T = TypeVar("T", bound=GithubObject)
|
|
|
|
class PaginatedListBase(Generic[T]):
|
|
def __getitem__(self, index: Union[int, slice]) -> Any: ...
|
|
def __init__(self) -> None: ...
|
|
def __iter__(self) -> Iterator[T]: ...
|
|
def _grow(self) -> Any: ...
|
|
def _isBiggerThan(self, index: int) -> bool: ...
|
|
class _Slice:
|
|
def __init__(self, theList: PaginatedList[T], theSlice: slice) -> None: ...
|
|
def __iter__(self) -> Iterator[T]: ...
|
|
def __finished(self, index: int) -> bool: ...
|
|
|
|
class PaginatedList(PaginatedListBase[T]):
|
|
def __init__(
|
|
self,
|
|
contentClass: Type[T],
|
|
requester: Requester,
|
|
firstUrl: str,
|
|
firstParams: Any,
|
|
headers: Optional[Dict[str, str]] = ...,
|
|
list_item: str = ...,
|
|
) -> None: ...
|
|
def __reverse(self) -> None: ...
|
|
def __parseLinkHeader(self, headers: Dict[str, str]) -> None: ...
|
|
def _couldGrow(self) -> bool: ...
|
|
def _fetchNextPage(self) -> Any: ...
|
|
def _getLastPageUrl(self) -> Optional[str]: ...
|
|
def get_page(self, page: int) -> List[Any]: ...
|
|
@property
|
|
def reversed(self) -> PaginatedList[T]: ...
|
|
@property
|
|
def totalCount(self) -> int: ...
|