From c742bc335c52ee0496cab998bb629c453ab719f8 Mon Sep 17 00:00:00 2001 From: Krzysztof Wojtas Date: Sun, 6 Oct 2024 03:31:28 +0200 Subject: [PATCH] #240 fix for Python <3.12 --- src/book/data_structures.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/book/data_structures.py b/src/book/data_structures.py index 05970a4..86aef35 100644 --- a/src/book/data_structures.py +++ b/src/book/data_structures.py @@ -9,17 +9,19 @@ from typing_extensions import Self +T = TypeVar('T') + + class Comparable(Protocol): def __le__(self, other: Any) -> bool: pass -class Indexable[T](Protocol): +class Indexable(Protocol[T]): __getitem__: Callable[[int], T] __setitem__: Callable[[int, T], None] -T = TypeVar('T') CT = TypeVar('CT', bound=Comparable) Bit = Literal[0, 1]