|
13 | 13 | T = TypeVar("T", bound=BaseType) |
14 | 14 | N = TypeVar("N", bound=int) |
15 | 15 |
|
| 16 | + |
16 | 17 | class AddressTypeSpec(StaticArrayTypeSpec): |
17 | 18 | def __init__(self) -> None: |
18 | 19 | super().__init__(ByteTypeSpec(), ADDRESS_LENGTH) |
@@ -40,16 +41,30 @@ def type_spec(self) -> AddressTypeSpec: |
40 | 41 | def get(self) -> Expr: |
41 | 42 | return self.stored_value.load() |
42 | 43 |
|
43 | | - def set(self, value: Union[Sequence[T], StaticArray[T, N], ComputedValue[StaticArray[T, N]], "Address", str, Expr]): |
44 | | - |
| 44 | + def set( |
| 45 | + self, |
| 46 | + value: Union[ |
| 47 | + Sequence[T], |
| 48 | + StaticArray[T, N], |
| 49 | + ComputedValue[StaticArray[T, N]], |
| 50 | + "Address", |
| 51 | + str, |
| 52 | + Expr, |
| 53 | + ], |
| 54 | + ): |
| 55 | + |
45 | 56 | if isinstance(value, ComputedValue): |
46 | 57 | if value.produced_type_spec() is not AddressTypeSpec(): |
47 | | - raise TealInputError(f"Got ComputedValue with type spec {value.produced_type_spec()}, expected AddressTypeSpec") |
| 58 | + raise TealInputError( |
| 59 | + f"Got ComputedValue with type spec {value.produced_type_spec()}, expected AddressTypeSpec" |
| 60 | + ) |
48 | 61 | return value.store_into(self) |
49 | 62 |
|
50 | 63 | if isinstance(value, BaseType): |
51 | 64 | if value.type_spec() is not AddressTypeSpec(): |
52 | | - raise TealInputError(f"Got {value.__class__} with type spec {value.type_spec()}, expected AddressTypeSpec") |
| 65 | + raise TealInputError( |
| 66 | + f"Got {value.__class__} with type spec {value.type_spec()}, expected AddressTypeSpec" |
| 67 | + ) |
53 | 68 | return self.decode(self.encode()) |
54 | 69 |
|
55 | 70 | if isinstance(value, str): |
|
0 commit comments