Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions stdlib/2and3/hmac.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/stubtest_whitelists/py38.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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__
Expand Down
1 change: 1 addition & 0 deletions tests/stubtest_whitelists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,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__
Expand Down