mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Add hmac (#402)
This commit is contained in:
committed by
Guido van Rossum
parent
cc735b1176
commit
cd413c502c
@@ -1,13 +0,0 @@
|
||||
# Stubs for hmac (Python 2)
|
||||
|
||||
from typing import Any, AnyStr
|
||||
|
||||
class HMAC:
|
||||
def update(self, msg: str) -> None: ...
|
||||
def digest(self) -> str: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> HMAC: ...
|
||||
|
||||
def new(key: str, msg: str = ..., digestmod: Any = ...) -> HMAC: ...
|
||||
|
||||
def compare_digest(a: AnyStr, b: AnyStr) -> bool: ...
|
||||
36
stdlib/2and3/hmac.pyi
Normal file
36
stdlib/2and3/hmac.pyi
Normal file
@@ -0,0 +1,36 @@
|
||||
# Stubs for hmac
|
||||
|
||||
from typing import Any, Callable, Optional, Union, overload
|
||||
from types import ModuleType
|
||||
import sys
|
||||
|
||||
_B = Union[bytes, bytearray]
|
||||
|
||||
# TODO more precise type for object of hashlib
|
||||
_Hash = Any
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
def new(key: _B, msg: Optional[_B] = ...,
|
||||
digestmod: Optional[Union[str, Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ...
|
||||
else:
|
||||
def new( # type: ignore
|
||||
key: _B, msg: Optional[_B] = ...,
|
||||
digestmod: Optional[Union[Callable[[], _Hash], ModuleType]] = ...) -> HMAC: ...
|
||||
|
||||
class HMAC:
|
||||
if sys.version_info >= (3,):
|
||||
digest_size = ... # type: int
|
||||
if sys.version_info >= (3, 4):
|
||||
block_size = ... # type: int
|
||||
name = ... # type: str
|
||||
def update(self, msg: _B) -> None: ...
|
||||
def digest(self) -> bytes: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
def copy(self) -> HMAC: ...
|
||||
|
||||
@overload
|
||||
def compare_digest(a: str, b: str) -> bool: ...
|
||||
@overload
|
||||
def compare_digest(a: bytes, b: bytes) -> bool: ...
|
||||
@overload
|
||||
def compare_digest(a: bytearray, b: bytearray) -> bool: ...
|
||||
@@ -1,108 +0,0 @@
|
||||
"""Stub file for the '_operator' module."""
|
||||
# This is an autogenerated file. It serves as a starting point
|
||||
# for a more precise manual annotation of this module.
|
||||
# Feel free to edit the source below, but remove this header when you do.
|
||||
|
||||
from typing import Any, List, Tuple, Dict, Generic
|
||||
|
||||
def _compare_digest(a, b) -> bool:
|
||||
raise BufferError()
|
||||
raise TypeError()
|
||||
|
||||
def abs(*args, **kwargs) -> Any: ...
|
||||
|
||||
def add(*args, **kwargs) -> Any: ...
|
||||
|
||||
def and_(*args, **kwargs) -> Any: ...
|
||||
|
||||
def concat(*args, **kwargs) -> Any: ...
|
||||
|
||||
def contains(*args, **kwargs) -> bool: ...
|
||||
|
||||
def countOf(*args, **kwargs) -> int: ...
|
||||
|
||||
def delitem(*args, **kwargs) -> None: ...
|
||||
|
||||
def eq(*args, **kwargs) -> Any: ...
|
||||
|
||||
def floordiv(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ge(*args, **kwargs) -> Any: ...
|
||||
|
||||
def getitem(*args, **kwargs) -> Any: ...
|
||||
|
||||
def gt(*args, **kwargs) -> Any: ...
|
||||
|
||||
def iadd(*args, **kwargs) -> Any: ...
|
||||
|
||||
def iand(*args, **kwargs) -> Any: ...
|
||||
|
||||
def iconcat(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ifloordiv(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ilshift(*args, **kwargs) -> Any: ...
|
||||
|
||||
def imod(*args, **kwargs) -> Any: ...
|
||||
|
||||
def imul(*args, **kwargs) -> Any: ...
|
||||
|
||||
def index(*args, **kwargs) -> Any: ...
|
||||
|
||||
def indexOf(*args, **kwargs) -> int: ...
|
||||
|
||||
def inv(*args, **kwargs) -> Any: ...
|
||||
|
||||
def invert(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ior(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ipow(*args, **kwargs) -> Any: ...
|
||||
|
||||
def irshift(*args, **kwargs) -> Any: ...
|
||||
|
||||
def is_(*args, **kwargs) -> bool: ...
|
||||
|
||||
def is_not(*args, **kwargs) -> bool: ...
|
||||
|
||||
def isub(*args, **kwargs) -> Any: ...
|
||||
|
||||
def itruediv(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ixor(*args, **kwargs) -> Any: ...
|
||||
|
||||
def le(*args, **kwargs) -> Any: ...
|
||||
|
||||
def length_hint(a, *args, **kwargs) -> int: ...
|
||||
|
||||
def lshift(*args, **kwargs) -> Any: ...
|
||||
|
||||
def lt(*args, **kwargs) -> Any: ...
|
||||
|
||||
def mod(*args, **kwargs) -> Any: ...
|
||||
|
||||
def mul(*args, **kwargs) -> Any: ...
|
||||
|
||||
def ne(*args, **kwargs) -> Any: ...
|
||||
|
||||
def neg(*args, **kwargs) -> Any: ...
|
||||
|
||||
def not_(*args, **kwargs) -> bool: ...
|
||||
|
||||
def or_(*args, **kwargs) -> Any: ...
|
||||
|
||||
def pos(*args, **kwargs) -> Any: ...
|
||||
|
||||
def pow(*args, **kwargs) -> Any: ...
|
||||
|
||||
def rshift(*args, **kwargs) -> Any: ...
|
||||
|
||||
def setitem(*args, **kwargs) -> None: ...
|
||||
|
||||
def sub(*args, **kwargs) -> Any: ...
|
||||
|
||||
def truediv(*args, **kwargs) -> Any: ...
|
||||
|
||||
def truth(*args, **kwargs) -> bool: ...
|
||||
|
||||
def xor(*args, **kwargs) -> Any: ...
|
||||
@@ -1,27 +0,0 @@
|
||||
# Stubs for hmac (Python 3.5)
|
||||
#
|
||||
# NOTE: This dynamically typed stub was automatically generated by stubgen.
|
||||
|
||||
from typing import Any
|
||||
from _operator import _compare_digest as compare_digest
|
||||
|
||||
trans_5C = ... # type: Any
|
||||
trans_36 = ... # type: Any
|
||||
digest_size = ... # type: Any
|
||||
|
||||
class HMAC:
|
||||
blocksize = ... # type: Any
|
||||
digest_cons = ... # type: Any
|
||||
outer = ... # type: Any
|
||||
inner = ... # type: Any
|
||||
digest_size = ... # type: Any
|
||||
block_size = ... # type: Any
|
||||
def __init__(self, key, msg=None, digestmod=None): ...
|
||||
@property
|
||||
def name(self): ...
|
||||
def update(self, msg): ...
|
||||
def copy(self): ...
|
||||
def digest(self): ...
|
||||
def hexdigest(self): ...
|
||||
|
||||
def new(key, msg=None, digestmod=None): ...
|
||||
Reference in New Issue
Block a user