From f7119c30ce5e5ad8c2344f6dea7c50bbd0a06893 Mon Sep 17 00:00:00 2001 From: abe <1127221+muendelezaji@users.noreply.github.com> Date: Thu, 19 Dec 2019 21:26:51 +0000 Subject: [PATCH] Update stubs for Crypto.Random (#3546) --- third_party/2and3/Crypto/Random/__init__.pyi | 6 ++++- third_party/2and3/Crypto/Random/random.pyi | 28 +++++++++++--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/third_party/2and3/Crypto/Random/__init__.pyi b/third_party/2and3/Crypto/Random/__init__.pyi index f30acfd3a..bc5620221 100644 --- a/third_party/2and3/Crypto/Random/__init__.pyi +++ b/third_party/2and3/Crypto/Random/__init__.pyi @@ -1 +1,5 @@ -def new(*args, **kwargs): ... +from typing import Any + +def new(*args: Any, **kwargs: Any): ... +def atfork() -> None: ... +def get_random_bytes(n: int) -> bytes: ... diff --git a/third_party/2and3/Crypto/Random/random.pyi b/third_party/2and3/Crypto/Random/random.pyi index 88ea62e33..8238b6cab 100644 --- a/third_party/2and3/Crypto/Random/random.pyi +++ b/third_party/2and3/Crypto/Random/random.pyi @@ -1,17 +1,19 @@ -from typing import Any, Optional +from typing import Any, List, Optional, Sequence, TypeVar + +_T = TypeVar('_T') class StrongRandom: def __init__(self, rng: Optional[Any] = ..., randfunc: Optional[Any] = ...) -> None: ... - def getrandbits(self, k): ... - def randrange(self, *args): ... - def randint(self, a, b): ... - def choice(self, seq): ... - def shuffle(self, x): ... - def sample(self, population, k): ... + def getrandbits(self, k: int) -> int: ... + def randrange(self, *args: int) -> int: ... + def randint(self, a: int, b: int) -> int: ... + def choice(self, seq: Sequence[_T]) -> _T: ... + def shuffle(self, x: Sequence[Any]): ... + def sample(self, population: Sequence[_T], k: int) -> List[_T]: ... -getrandbits: Any -randrange: Any -randint: Any -choice: Any -shuffle: Any -sample: Any +def getrandbits(k: int) -> int: ... +def randrange(*args: int) -> int: ... +def randint(a: int, b: int) -> int: ... +def choice(seq: Sequence[_T]) -> _T: ... +def shuffle(x: Sequence[Any]): ... +def sample(population: Sequence[_T], k: int) -> List[_T]: ...