Skip to content

Commit bfaf1c1

Browse files
Make ABI types fully specified (#222)
* Convert Type and Tuple to indexable types * Convert and combine uint types * Fix type and unit tests * Convert Bool * Fix Tuple getitem * Convert arrays and array tests * Fix tuple tests * [WIP] satisfy mypy * Refactor ABI types * Update docs, add Tuple4 and Tuple5, and change type_spec method name * No longer test on Python 3.6 and 3.7 * No longer test on Python 3.6 and 3.7 * Remove accidentally included file * Add another literal test case * Debugging through CI * blacken * Remove problematic test case * Minor test coverage improvements * Unit test to make sure type_spec_from_annotation always works on all types * Partially address feedback * Make uint8 != byte and use typing.Final in a few constructors * Undo custom set methods * Fix typo Co-authored-by: Michael Diamant <[email protected]> Co-authored-by: Michael Diamant <[email protected]>
1 parent 0ff98a8 commit bfaf1c1

20 files changed

+2670
-1825
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
container: python:${{ matrix.python }}-slim
1313
strategy:
1414
matrix:
15-
python: ['3.6', '3.7', '3.8', '3.9', '3.10']
15+
python: ['3.8', '3.9', '3.10']
1616
steps:
1717
- run: python3 --version
1818
- name: Check out code

pyteal/ast/abi/__init__.py

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,68 @@
1-
from .type import Type, ComputedType
2-
from .bool import Bool
3-
from .uint import Uint, Byte, Uint8, Uint16, Uint32, Uint64
4-
from .tuple import Tuple
5-
from .array import StaticArray, DynamicArray
1+
from .type import TypeSpec, BaseType, ComputedType
2+
from .bool import BoolTypeSpec, Bool
3+
from .uint import (
4+
UintTypeSpec,
5+
Uint,
6+
ByteTypeSpec,
7+
Byte,
8+
Uint8TypeSpec,
9+
Uint8,
10+
Uint16TypeSpec,
11+
Uint16,
12+
Uint32TypeSpec,
13+
Uint32,
14+
Uint64TypeSpec,
15+
Uint64,
16+
)
17+
from .tuple import (
18+
TupleTypeSpec,
19+
Tuple,
20+
TupleElement,
21+
Tuple0,
22+
Tuple1,
23+
Tuple2,
24+
Tuple3,
25+
Tuple4,
26+
Tuple5,
27+
)
28+
from .array_base import ArrayTypeSpec, Array, ArrayElement
29+
from .array_static import StaticArrayTypeSpec, StaticArray
30+
from .array_dynamic import DynamicArrayTypeSpec, DynamicArray
31+
from .util import type_spec_from_annotation
632

733
__all__ = [
8-
"Type",
34+
"TypeSpec",
35+
"BaseType",
936
"ComputedType",
37+
"BoolTypeSpec",
1038
"Bool",
39+
"UintTypeSpec",
1140
"Uint",
41+
"ByteTypeSpec",
1242
"Byte",
43+
"Uint8TypeSpec",
1344
"Uint8",
45+
"Uint16TypeSpec",
1446
"Uint16",
47+
"Uint32TypeSpec",
1548
"Uint32",
49+
"Uint64TypeSpec",
1650
"Uint64",
51+
"TupleTypeSpec",
1752
"Tuple",
53+
"TupleElement",
54+
"Tuple0",
55+
"Tuple1",
56+
"Tuple2",
57+
"Tuple3",
58+
"Tuple4",
59+
"Tuple5",
60+
"ArrayTypeSpec",
61+
"Array",
62+
"ArrayElement",
63+
"StaticArrayTypeSpec",
1864
"StaticArray",
65+
"DynamicArrayTypeSpec",
1966
"DynamicArray",
67+
"type_spec_from_annotation",
2068
]

0 commit comments

Comments
 (0)