mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from types import ModuleType
|
||||
from typing import Any, AnyStr, Callable, Optional, Union, overload
|
||||
from typing import Any, AnyStr, Callable, Union, overload
|
||||
|
||||
# TODO more precise type for object of hashlib
|
||||
_Hash = Any
|
||||
@@ -13,18 +13,18 @@ if sys.version_info >= (3, 8):
|
||||
# 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: bytes, msg: Optional[ReadableBuffer], digestmod: _DigestMod) -> HMAC: ...
|
||||
def new(key: bytes, msg: ReadableBuffer | None, digestmod: _DigestMod) -> HMAC: ...
|
||||
@overload
|
||||
def new(key: bytes, *, digestmod: _DigestMod) -> HMAC: ...
|
||||
|
||||
else:
|
||||
def new(key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: Optional[_DigestMod] = ...) -> HMAC: ...
|
||||
def new(key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ...
|
||||
|
||||
class HMAC:
|
||||
digest_size: int
|
||||
block_size: int
|
||||
name: str
|
||||
def __init__(self, key: bytes, msg: Optional[ReadableBuffer] = ..., digestmod: _DigestMod = ...) -> None: ...
|
||||
def __init__(self, key: bytes, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ...
|
||||
def update(self, msg: ReadableBuffer) -> None: ...
|
||||
def digest(self) -> bytes: ...
|
||||
def hexdigest(self) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user