Update type hints for the hashlib.new() stub (#4973)

Python 3.9 added the usedforsecurity kwarg as discussed in:
https://bugs.python.org/issue9216
The stubs for the other constructors were updated to reflect this change, but
the stub for new() was missed.
This commit is contained in:
Nick M
2021-01-26 11:01:55 -05:00
committed by GitHub
parent a1a51f5aac
commit 9d07d74a12

View File

@@ -17,6 +17,7 @@ class _Hash(object):
def update(self, __data: ReadableBuffer) -> None: ...
if sys.version_info >= (3, 9):
def new(name: str, data: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def md5(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha1(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha224(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
@@ -25,6 +26,7 @@ if sys.version_info >= (3, 9):
def sha512(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
elif sys.version_info >= (3, 8):
def new(name: str, data: ReadableBuffer = ...) -> _Hash: ...
def md5(string: ReadableBuffer = ...) -> _Hash: ...
def sha1(string: ReadableBuffer = ...) -> _Hash: ...
def sha224(string: ReadableBuffer = ...) -> _Hash: ...
@@ -33,6 +35,7 @@ elif sys.version_info >= (3, 8):
def sha512(string: ReadableBuffer = ...) -> _Hash: ...
else:
def new(name: str, data: ReadableBuffer = ...) -> _Hash: ...
def md5(__string: ReadableBuffer = ...) -> _Hash: ...
def sha1(__string: ReadableBuffer = ...) -> _Hash: ...
def sha224(__string: ReadableBuffer = ...) -> _Hash: ...
@@ -40,8 +43,6 @@ else:
def sha384(__string: ReadableBuffer = ...) -> _Hash: ...
def sha512(__string: ReadableBuffer = ...) -> _Hash: ...
def new(name: str, data: ReadableBuffer = ...) -> _Hash: ...
algorithms_guaranteed: AbstractSet[str]
algorithms_available: AbstractSet[str]