Fix AbstractDigestAuthHandler to have correct types.

This commit is contained in:
David Euresti
2017-02-21 12:41:46 -08:00
committed by Łukasz Langa
parent 70e39d9ad2
commit 91ff50ad7a
2 changed files with 18 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
from typing import AnyStr, Dict, List, Union
from typing import AnyStr, Dict, List, Union, Optional, Mapping, Callable, Tuple
from urllib import addinfourl
from httplib import HTTPResponse
class URLError(IOError):
reason = ... # type: Union[str, BaseException]
@@ -99,14 +100,15 @@ class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
def http_error_407(self, req, fp, code, msg, headers): ...
class AbstractDigestAuthHandler:
def __init__(self, passwd=None): ...
def reset_retry_count(self): ...
def http_error_auth_reqed(self, auth_header, host, req, headers): ...
def retry_http_digest_auth(self, req, auth): ...
def get_cnonce(self, nonce): ...
def get_authorization(self, req, chal): ...
def get_algorithm_impls(self, algorithm): ...
def get_entity_digest(self, data, chal): ...
def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ...
def reset_retry_count(self) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request,
headers: Mapping[str, str]) -> None: ...
def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[HTTPResponse]: ...
def get_cnonce(self, nonce: str) -> str: ...
def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ...
def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ...
def get_entity_digest(self, data: Optional[bytes], chal: Mapping[str, str]) -> Optional[str]: ...
class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
auth_header = ... # str

View File

@@ -139,10 +139,15 @@ class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler):
hdrs: Mapping[str, str]) -> Optional[_UrlopenRet]: ...
class AbstractDigestAuthHandler:
def __init__(self,
password_mgr: Optional[HTTPPasswordMgr] = ...) -> None: ...
def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ...
def reset_retry_count(self) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request,
headers: Mapping[str, str]) -> None: ...
def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[_UrlopenRet]: ...
def get_cnonce(self, nonce: str) -> str: ...
def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ...
def get_algorithm_impls(self, algorithm: str) -> Tuple[Callable[[str], str], Callable[[str, str], str]]: ...
def get_entity_digest(self, data: Optional[bytes], chal: Mapping[str, str]) -> Optional[str]: ...
class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler):
def http_error_401(self, req: Request, fp: IO[str], code: int, msg: int,