fix: use type parameter instead of subclass

This commit is contained in:
Jann Stute
2026-05-11 20:31:56 +02:00
parent 67efc35e96
commit 70de571ef4
2 changed files with 4 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
from abc import ABC, abstractmethod
from enum import Enum
from typing import Generic, TypeVar, override
from typing import TypeVar, override
class ConstraintType(Enum):
@@ -97,7 +97,7 @@ class Not(AST):
T = TypeVar("T")
class BaseVisitor(ABC, Generic[T]):
class BaseVisitor[T](ABC):
def visit(self, node: AST) -> T:
if isinstance(node, ANDList):
return self.visit_and_list(node)

View File

@@ -21,7 +21,7 @@ from collections import OrderedDict
from pathlib import Path
from queue import Queue
from shutil import which
from typing import Generic, TypeVar
from typing import TypeVar
from warnings import catch_warnings
import structlog
@@ -148,7 +148,7 @@ T = TypeVar("T")
# | A [B]<- C |
# |[A]<- B C | Previous routes still exist
# | A ->[D] | Stack is cut from [:A] on new route
class History(Generic[T]):
class History[T]:
__history: list[T]
__index: int = 0