diff --git a/pyteal/ast/abi/bool.py b/pyteal/ast/abi/bool.py index e53d11bba..6a376e7cf 100644 --- a/pyteal/ast/abi/bool.py +++ b/pyteal/ast/abi/bool.py @@ -93,6 +93,9 @@ def encode(self) -> Expr: return SetBit(Bytes(b"\x00"), Int(0), self.get()) +Bool.__module__ = "pyteal" + + def boolAwareStaticByteLength(types: Sequence[TypeSpec]) -> int: length = 0 ignoreNext = 0 diff --git a/pyteal/ast/abi/type.py b/pyteal/ast/abi/type.py index 3eb0ef058..8935a9d71 100644 --- a/pyteal/ast/abi/type.py +++ b/pyteal/ast/abi/type.py @@ -142,6 +142,9 @@ def _set_with_computed_type(self, value: "ComputedValue") -> Expr: ) return value.store_into(self) + def __str__(self) -> str: + return str(self.type_spec()) + BaseType.__module__ = "pyteal" diff --git a/pyteal/ast/abi/util_test.py b/pyteal/ast/abi/util_test.py index f4fdbb2b8..1e5f6b96a 100644 --- a/pyteal/ast/abi/util_test.py +++ b/pyteal/ast/abi/util_test.py @@ -336,7 +336,12 @@ def test_size_of(): # Test for byte/bool/address/strings (algosdk.abi.ByteType(), "byte", abi.ByteTypeSpec(), abi.Byte), (algosdk.abi.BoolType(), "bool", abi.BoolTypeSpec(), abi.Bool), - (algosdk.abi.AddressType(), "address", abi.AddressTypeSpec(), abi.Address), + ( + algosdk.abi.AddressType(), + "address", + abi.AddressTypeSpec(), + abi.Address, + ), (algosdk.abi.StringType(), "string", abi.StringTypeSpec(), abi.String), # Test for dynamic array type ( @@ -489,7 +494,6 @@ def test_size_of(): # ] # ), # ), - (algosdk.abi.TupleType([]), "()", abi.TupleTypeSpec(), abi.Tuple0), ( "cannot map ABI transaction type spec str: - return "(method: {})".format(self.methodName) + return "(MethodSignature '{}')".format(self.methodName) def type_of(self) -> TealType: return TealType.bytes diff --git a/pyteal/ast/naryexpr.py b/pyteal/ast/naryexpr.py index f0aa564e8..0af86d2bb 100644 --- a/pyteal/ast/naryexpr.py +++ b/pyteal/ast/naryexpr.py @@ -48,7 +48,7 @@ def __teal__(self, options: "CompileOptions"): return start, end def __str__(self): - ret_str = "(" + str(self.op) + ret_str = "(" + str(self.op).title().replace("_", "") for a in self.args: ret_str += " " + a.__str__() ret_str += ")" diff --git a/pyteal/ast/unaryexpr.py b/pyteal/ast/unaryexpr.py index 619bfab46..da2dbb165 100644 --- a/pyteal/ast/unaryexpr.py +++ b/pyteal/ast/unaryexpr.py @@ -31,7 +31,7 @@ def __teal__(self, options: "CompileOptions"): return TealBlock.FromOp(options, TealOp(self, self.op), self.arg) def __str__(self): - return "({} {})".format(self.op, self.arg) + return "({} {})".format(str(self.op).title().replace("_", ""), self.arg) def type_of(self): return self.outputType