Files
PyGithub/github/Requester.pyi
T
Alice GIRARDandLiuyang Wan 91433fe925 Type stubs for mypy (#1231)
* First attempt at stubs

* fix AuthenticatedUser.piy

* fix PullRequest.piy

* fix Authorization.piy

* fix Branch.piy

* fix Clones.piy

* fix Commit.piy

* fix CommitCombinedStatus.piy

* fix CommitComment.piy

* fix CommitStatus.piy

* fix ContentFile.piy

* fix Download.piy

* fix Event.piy

* fix File.piy

* fix Gist.piy

* fix GistComment.piy

* fix GistFile.piy

* fix GitAuthor.piy

* fix GitBlob.piy

* fix GitCommit.piy

* fix GitRef.piy

* fix GitRelease.piy

* renamed stubs into pyi files

* fix Notification

* fix Repository

* fix GitReleaseAsset

* fix GitTag

* fix GitTree

* fix GitTreeElement

* fix GithubException

* fix GithubObject

* fix GitignoreTemplate

* fix HookDescription

* fix HookResponse

* fix InputGitAuthor

* fix Installation

* fix InstallationAuthorization

* fix Invitation

* fix Issue

* fix IssueComment

* Fix random issues found while testing

* fix IssuePullRequest

* fix Label

* fix License

* fix Migration

* fix Milestone

* fix NamedUser

* fix NotificationSubject

* fix Organization

* fix PaginatedList

* fix Path

* fix Permissions

* fix Plan

* fix Project

* fix ProjectCard

* fix ProjectColumn

* fix PullRequestComment

* fix PullRequestMergeStatus

* fix PullRequestPart

* fix PullRequestReview

* fix Rate

* fix RateLimit

* fix Reaction

* fix Referrer

* fix RepositoryKey

* fix RequiredPullRequestReviews

* fix RequiredStatusChecks

* fix SourceImport

* fix Stargazer

* fix StatsCodeFrequency

* fix StatsCommitActivity

* fix StatsContributor

* fix Tag

* fix Team

* fix Topic

* fix UserKey

* fix MainClass

* fix Requester

* added stubs for View

* added stubs for Membership

* various syntax errors

* silence mypy noise

* keeping track of recent changes

* black + isort

Co-authored-by: Liuyang Wan <lwan@zendesk.com>
2020-03-22 19:33:23 +08:00

179 lines
5.7 KiB
Python

from collections import OrderedDict
from io import BufferedReader
from typing import Any, Callable, Dict, Iterator, Optional, Tuple, Union
from requests.models import Response
from github.GithubObject import GithubObject
from tests.Framework import ReplayingHttpsConnection
# from urllib3.util.retry import Retry
class HTTPRequestsConnectionClass:
def __init__(
self,
host: str,
port: Optional[int] = ...,
strict: bool = ...,
timeout: Optional[int] = ...,
retry: Any = ...,
**kwargs
) -> None: ...
def close(self) -> None: ...
def getresponse(self) -> RequestsResponse: ...
def request(
self, verb: str, url: str, input: None, headers: Dict[str, str]
) -> None: ...
class HTTPSRequestsConnectionClass:
def __init__(
self,
host: str,
port: Optional[int] = ...,
strict: bool = ...,
timeout: Optional[int] = ...,
retry: Any = ...,
**kwargs
) -> None: ...
def close(self) -> None: ...
def getresponse(self) -> RequestsResponse: ...
def request(
self,
verb: str,
url: str,
input: Optional[Union[str, BufferedReader]],
headers: Dict[str, str],
) -> None: ...
class Requester:
def DEBUG_ON_RESPONSE(
self, statusCode: int, responseHeader: Dict[str, str], data: str
) -> None: ...
def NEW_DEBUG_FRAME(self, requestHeader: Dict[str, str]) -> None: ...
def __check(
self, status: int, responseHeader: Dict[str, Any], output: str,
) -> Tuple[Dict[str, Any], Dict[str, Any]]: ...
def __addParametersToUrl(self, url: str, parameters: Dict[str, Any],) -> str: ...
def __authenticate(
self, url: str, responseHeader: Dict[str, Any], parameters: Dict[str, Any],
) -> None: ...
def __customConnection(self, url: str,) -> Optional[ReplayingHttpsConnection]: ...
def __createConnection(
self,
) -> Union[HTTPRequestsConnectionClass, HTTPSRequestsConnectionClass]: ...
def __createException(
self, status: int, headers: Dict[str, Any], output: str,
) -> Any: ...
def __log(
self,
verb: str,
url: str,
requestHeaders: Dict[str, str],
input: Optional[str],
status: Optional[int],
responseHeader: Dict[str, Any],
output: Optional[str],
) -> None: ...
def __makeAbsoluteUrl(self, url: str) -> str: ...
def __structuredFromJson(self, data: str) -> Optional[Dict[str, Any]]: ...
def __requestEncode(
self,
verb: str,
url: str,
parameters: Dict[str, str] = ...,
headers: Dict[str, str] = ...,
input: Optional[str] = ...,
encode: Callable = ...,
) -> Tuple[int, Dict[str, Any], str]: ...
def __requestRaw(
self,
verb: str,
url: str,
parameters: Dict[str, str] = ...,
headers: Dict[str, str] = ...,
input: Optional[str] = ...,
) -> Tuple[int, Dict[str, Any], str]: ...
def __init__(
self,
login_or_token: Optional[str],
password: Optional[str],
jwt: Optional[str],
base_url: str,
timeout: int,
client_id: Optional[str],
client_secret: Optional[str],
user_agent: str,
per_page: int,
api_preview: bool,
verify: bool,
retry: Any,
) -> None: ...
def _initializeDebugFeature(self) -> None: ...
def check_me(self, obj: GithubObject) -> None: ...
@classmethod
def injectConnectionClasses(
cls, httpConnectionClass: Callable, httpsConnectionClass: Callable
) -> None: ...
def requestBlob(
self,
verb: str,
url: str,
parameters: Dict[str, str] = ...,
headers: Dict[str, str] = ...,
input: Optional[str] = ...,
cnx: Optional[ReplayingHttpsConnection] = ...,
) -> Tuple[int, Dict[str, Any], str]: ...
def requestBlobAndCheck(
self,
verb: str,
url: str,
parameters: Optional[Dict[str, Any]] = ...,
headers: Optional[Dict[str, Any]] = ...,
input: Optional[str] = ...,
) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]: ...
def requestJson(
self,
verb: str,
url: str,
parameters: Optional[Dict[str, Any]] = ...,
headers: Optional[Dict[str, Any]] = ...,
input: Optional[Any] = ...,
cnx: Optional[ReplayingHttpsConnection] = ...,
) -> Tuple[int, Dict[str, Any], str]: ...
def requestJsonAndCheck(
self,
verb: str,
url: str,
parameters: Optional[Dict[str, Any]] = ...,
headers: Optional[Dict[str, str]] = ...,
input: Optional[Any] = ...,
) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]: ...
def requestMultipart(
self,
verb: str,
url: str,
parameters: Optional[Dict[str, Any]] = ...,
headers: Optional[Dict[str, Any]] = ...,
input: Optional[OrderedDict] = ...,
cnx: Optional[ReplayingHttpsConnection] = ...,
) -> Tuple[int, Dict[str, Any], str]: ...
def requestMultipartAndCheck(
self,
verb: str,
url: str,
parameters: Optional[Dict[str, Any]] = ...,
headers: Optional[Dict[str, Any]] = ...,
input: Optional[OrderedDict] = ...,
) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]: ...
@classmethod
def resetConnectionClasses(cls) -> None: ...
@classmethod
def setDebugFlag(cls, flag: bool) -> None: ...
@classmethod
def setOnCheckMe(cls, onCheckMe: Callable) -> None: ...
class RequestsResponse:
def __init__(self, r: Response) -> None: ...
def getheaders(self) -> Iterator[Any]: ...
def read(self) -> str: ...