From 54a342a7f5b74f32c7a53ea483d9046e688b9830 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Fri, 24 Jul 2020 03:22:41 +0900 Subject: Add and correct some type hints --- shared-bindings/random/__init__.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shared-bindings/random') diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 10ddca499..35756eef1 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -46,6 +46,9 @@ //| .. warning:: Numbers from this module are not cryptographically strong! Use //| bytes from `os.urandom` directly for true randomness.""" //| +//| from typing import TypeVar +//| _T = TypeVar('_T') +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to @@ -129,7 +132,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(random_randint_obj, random_randint); -//| def choice(seq: list) -> Any: +//| def choice(seq: Sequence[_T]) -> _T: //| """Returns a randomly selected element from the given sequence. Raises //| IndexError when the sequence is empty.""" //| ... -- cgit v1.2.3