mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
hmac digestmod is no longer Optional as of 3.8. (#3367)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Stubs for hmac
|
||||
|
||||
from typing import Any, Callable, Optional, Union, overload, AnyStr
|
||||
from typing import Any, Callable, Optional, Union, overload, AnyStr, overload
|
||||
from types import ModuleType
|
||||
import sys
|
||||
|
||||
@@ -11,7 +11,15 @@ _Hash = Any
|
||||
|
||||
digest_size: None
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
if sys.version_info >= (3, 8):
|
||||
_DigestMod = Union[str, Callable[[], _Hash], ModuleType]
|
||||
# In reality digestmod has a default value, but the function always throws an error
|
||||
# if the argument is not given, so we pretend it is a required argument.
|
||||
@overload
|
||||
def new(key: _B, msg: Optional[_B], digestmod: _DigestMod) -> HMAC: ...
|
||||
@overload
|
||||
def new(key: _B, *, digestmod: _DigestMod) -> HMAC: ...
|
||||
elif sys.version_info >= (3, 4):
|
||||
def new(key: _B, msg: Optional[_B] = ...,
|
||||
digestmod: Optional[Union[str, Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ...
|
||||
else:
|
||||
|
||||
@@ -46,6 +46,7 @@ functools.partialmethod.__get__
|
||||
functools.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable
|
||||
gettext.install
|
||||
gettext.translation
|
||||
hmac.new # Stub is a white lie; see comments in the stub
|
||||
http.client.HTTPSConnection.__init__
|
||||
http.cookiejar.DefaultCookiePolicy.__init__
|
||||
http.server.SimpleHTTPRequestHandler.__init__
|
||||
|
||||
@@ -97,6 +97,7 @@ functools.singledispatchmethod.__call__
|
||||
gettext.install
|
||||
gettext.translation
|
||||
hmac.compare_digest
|
||||
hmac.new # Stub is a white lie; see comments in the stub
|
||||
http.client.HTTPSConnection.__init__
|
||||
http.cookiejar.DefaultCookiePolicy.__init__
|
||||
http.server.SimpleHTTPRequestHandler.__init__
|
||||
|
||||
Reference in New Issue
Block a user