mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-30 08:04:24 +08:00
Fix hashlib to accept multiple data types (#918)
This commit is contained in:
committed by
Guido van Rossum
parent
6eca1a04da
commit
db84eb7844
@@ -1,24 +1,26 @@
|
||||
# Stubs for hashlib (Python 2)
|
||||
|
||||
from typing import Tuple
|
||||
from typing import Tuple, Union
|
||||
|
||||
_DataType = Union[str, bytearray, buffer, memoryview]
|
||||
|
||||
class _hash(object):
|
||||
# This is not actually in the module namespace.
|
||||
digest_size = 0
|
||||
block_size = 0
|
||||
def update(self, arg: str) -> None: ...
|
||||
def update(self, arg: _DataType) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> _hash: ...
|
||||
|
||||
def new(name: str, data: str = ...) -> _hash: ...
|
||||
|
||||
def md5(s: str = ...) -> _hash: ...
|
||||
def sha1(s: str = ...) -> _hash: ...
|
||||
def sha224(s: str = ...) -> _hash: ...
|
||||
def sha256(s: str = ...) -> _hash: ...
|
||||
def sha384(s: str = ...) -> _hash: ...
|
||||
def sha512(s: str = ...) -> _hash: ...
|
||||
def md5(s: _DataType = ...) -> _hash: ...
|
||||
def sha1(s: _DataType = ...) -> _hash: ...
|
||||
def sha224(s: _DataType = ...) -> _hash: ...
|
||||
def sha256(s: _DataType = ...) -> _hash: ...
|
||||
def sha384(s: _DataType = ...) -> _hash: ...
|
||||
def sha512(s: _DataType = ...) -> _hash: ...
|
||||
|
||||
algorithms = ... # type: Tuple[str, ...]
|
||||
algorithms_guaranteed = ... # type: Tuple[str, ...]
|
||||
|
||||
Reference in New Issue
Block a user