Finally, I made mypy shutup! solution in Clear category for Multicolored Lamp by hanpari
import typing as tp
from itertools import cycle
Lights: tp.Iterable[str] = ("Green", "Red", "Blue", "Yellow")
T = tp.TypeVar("T")
LightCycler = tp.Callable[, T]
def light_creator(states: tp.Iterable[T]) -> LightCycler:
state = cycle(states)
def light() -> T:
def __init__(self, light: tp.Iterable[str] = Lights) -> None:
self.light = light_creator(Lights)
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
lamp_1 = Lamp()
lamp_2 = Lamp()
assert lamp_1.light() == "Blue"
assert lamp_1.light() == "Yellow"
assert lamp_1.light() == "Green"
assert lamp_2.light() == "Red"
assert lamp_2.light() == "Blue"
print("Coding complete? Let's try tests!")
July 14, 2018