From 613840ebcf303e84048d48ace37fb001c1afe687 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Sat, 6 May 2023 16:12:32 +0100 Subject: Apply fixes for ruff linting Co-authored-by: wookie184 Co-authored-by: Amrou Bellalouna --- bot/utils/randomization.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bot/utils/randomization.py') diff --git a/bot/utils/randomization.py b/bot/utils/randomization.py index c9eabbd2..1caff3fa 100644 --- a/bot/utils/randomization.py +++ b/bot/utils/randomization.py @@ -1,7 +1,9 @@ import itertools import random from collections.abc import Iterable -from typing import Any +from typing import TypeVar + +T = TypeVar("T") class RandomCycle: @@ -11,11 +13,11 @@ class RandomCycle: The iterable is reshuffled after each full cycle. """ - def __init__(self, iterable: Iterable): + def __init__(self, iterable: Iterable[T]): self.iterable = list(iterable) self.index = itertools.cycle(range(len(iterable))) - def __next__(self) -> Any: + def __next__(self) -> T: idx = next(self.index) if idx == 0: -- cgit v1.2.3