From 7fcdae814aa6ce1518d0ad0ada8bbb22cae9bfbe Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 19 Nov 2021 10:43:19 -0500 Subject: [PATCH] Correct SExp.to hints to handle inheritance --- clvm/SExp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clvm/SExp.py b/clvm/SExp.py index 398fe108..3b936453 100644 --- a/clvm/SExp.py +++ b/clvm/SExp.py @@ -117,6 +117,8 @@ def to_sexp_type( return stack[0] +_T_SExp = typing.TypeVar("_T_SExp", bound="SExp") + class SExp: """ SExp provides higher level API on top of any object implementing the CLVM @@ -173,7 +175,7 @@ def as_bin(self): return f.getvalue() @classmethod - def to(class_, v: CastableType) -> "SExp": + def to(class_: typing.Type[_T_SExp], v: CastableType) -> _T_SExp: if isinstance(v, class_): return v