@@ -45,7 +45,7 @@ class DynArray:
45
45
"""Dynamic length array representation."""
46
46
47
47
type : str
48
- max_length : int
48
+ max_length : Union [ int , Constant ]
49
49
50
50
def __post_init__ (self ) -> None :
51
51
if self .type not in VALID_VYPER_TYPES :
@@ -63,9 +63,9 @@ class Parameter:
63
63
type : Type
64
64
65
65
def __post_init__ (self ) -> None :
66
- if self .type .startswith ("DynArray" ):
67
- assert self .type .endswith ("]" )
68
- type , max_length = self .type [:- 1 ].split ("[" )[1 ].split ("," )
66
+ if self .type .startswith ("DynArray" ): # type: ignore [union-attr]
67
+ assert self .type .endswith ("]" ) # type: ignore [union-attr]
68
+ type , max_length = self .type [:- 1 ].split ("[" )[1 ].split ("," ) # type: ignore [index]
69
69
try :
70
70
self .type = DynArray (type , int (max_length ))
71
71
except ValueError :
@@ -95,8 +95,8 @@ class Function:
95
95
96
96
def __post_init__ (self ) -> None :
97
97
if self .return_type is not None :
98
- if self .return_type .startswith ("(" ):
99
- self .return_type = Tuple (self .return_type [1 :- 1 ].split ("," ))
98
+ if self .return_type .startswith ("(" ): # type: ignore [union-attr]
99
+ self .return_type = Tuple (self .return_type [1 :- 1 ].split ("," )) # type: ignore [index]
100
100
elif self .return_type not in VALID_VYPER_TYPES :
101
101
logger .warning (f"{ self } does not return a valid Vyper type" )
102
102
@@ -217,9 +217,6 @@ def _parse_params(params_str: str) -> List[Parameter]:
217
217
for param in re .finditer (param_pattern , params_str ):
218
218
name , type_str = param .group ().split (":" )
219
219
type_str = type_str .strip ()
220
- if type_str [1 ] == "(" :
221
- typ = Tuple (type_str [1 :- 1 ].split ("," ))
222
- else :
223
- typ = type_str
220
+ typ = Tuple (type_str [1 :- 1 ].split ("," )) if type_str [1 ] == "(" else type_str
224
221
params .append (Parameter (name = name .strip (), type = typ ))
225
222
return params
0 commit comments