diff options
author | 2023-05-06 16:12:32 +0100 | |
---|---|---|
committer | 2023-05-09 15:41:50 +0100 | |
commit | 613840ebcf303e84048d48ace37fb001c1afe687 (patch) | |
tree | 9acaf0bae0527fe8389483a419b44e06997ca060 /bot/utils/randomization.py | |
parent | Migrate to ruff (diff) |
Apply fixes for ruff linting
Co-authored-by: wookie184 <[email protected]>
Co-authored-by: Amrou Bellalouna <[email protected]>
Diffstat (limited to 'bot/utils/randomization.py')
-rw-r--r-- | bot/utils/randomization.py | 8 |
1 files changed, 5 insertions, 3 deletions
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: |