From d57499ef33646ae9c1af4ee82110aefb28965ccc Mon Sep 17 00:00:00 2001 From: Matt Hauff Date: Tue, 10 Aug 2021 14:05:23 -0700 Subject: [PATCH 1/4] Added py.typed files to package so that mypy can analyze them --- clvm/py.typed | 0 setup.py | 3 +++ 2 files changed, 3 insertions(+) create mode 100644 clvm/py.typed diff --git a/clvm/py.typed b/clvm/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/setup.py b/setup.py index a1a86be7..568e3750 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,9 @@ setup( name="clvm", packages=["clvm",], + package_data={ + "": ["py.typed"], + }, author="Chia Network, Inc.", author_email="hello@chia.net", url="https://github.com/Chia-Network/clvm", From f3d08034fcfc8a97f3d3cba9fb0e0ce1733e6146 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Fri, 19 Nov 2021 10:43:19 -0500 Subject: [PATCH 2/4] 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 From e24b16084ee2d8ef68757f201be30737f969a9f2 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 24 Nov 2021 11:00:51 -0500 Subject: [PATCH 3/4] flake8 --- clvm/SExp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/clvm/SExp.py b/clvm/SExp.py index 3b936453..f0893b3d 100644 --- a/clvm/SExp.py +++ b/clvm/SExp.py @@ -119,6 +119,7 @@ def to_sexp_type( _T_SExp = typing.TypeVar("_T_SExp", bound="SExp") + class SExp: """ SExp provides higher level API on top of any object implementing the CLVM From 6848b910dfc0694502eb14dfeef27912f6143b76 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 24 Nov 2021 23:56:42 -0500 Subject: [PATCH 4/4] drop the bound="SExp" --- clvm/SExp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clvm/SExp.py b/clvm/SExp.py index f0893b3d..44022ba1 100644 --- a/clvm/SExp.py +++ b/clvm/SExp.py @@ -117,7 +117,7 @@ def to_sexp_type( return stack[0] -_T_SExp = typing.TypeVar("_T_SExp", bound="SExp") +_T_SExp = typing.TypeVar("_T_SExp") class SExp: