@@ -835,7 +835,7 @@ def pop_format_context(self, expl_expr: ast.expr) -> ast.Name:
835
835
current = self .stack .pop ()
836
836
if self .stack :
837
837
self .explanation_specifiers = self .stack [- 1 ]
838
- keys = [ast .Constant (key ) for key in current .keys ()]
838
+ keys : List [ Optional [ ast . expr ]] = [ast .Constant (key ) for key in current .keys ()]
839
839
format_dict = ast .Dict (keys , list (current .values ()))
840
840
form = ast .BinOp (expl_expr , ast .Mod (), format_dict )
841
841
name = "@py_format" + str (next (self .variable_counter ))
@@ -926,13 +926,13 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]:
926
926
[* self .expl_stmts , hook_call_pass ],
927
927
[],
928
928
)
929
- statements_pass = [hook_impl_test ]
929
+ statements_pass : List [ ast . stmt ] = [hook_impl_test ]
930
930
931
931
# Test for assertion condition
932
932
main_test = ast .If (negation , statements_fail , statements_pass )
933
933
self .statements .append (main_test )
934
934
if self .format_variables :
935
- variables = [
935
+ variables : List [ ast . expr ] = [
936
936
ast .Name (name , ast .Store ()) for name in self .format_variables
937
937
]
938
938
clear_format = ast .Assign (variables , ast .Constant (None ))
@@ -1114,11 +1114,11 @@ def visit_Compare(self, comp: ast.Compare) -> Tuple[ast.expr, str]:
1114
1114
if isinstance (comp .left , (ast .Compare , ast .BoolOp )):
1115
1115
left_expl = f"({ left_expl } )"
1116
1116
res_variables = [self .variable () for i in range (len (comp .ops ))]
1117
- load_names = [ast .Name (v , ast .Load ()) for v in res_variables ]
1117
+ load_names : List [ ast . expr ] = [ast .Name (v , ast .Load ()) for v in res_variables ]
1118
1118
store_names = [ast .Name (v , ast .Store ()) for v in res_variables ]
1119
1119
it = zip (range (len (comp .ops )), comp .ops , comp .comparators )
1120
- expls = []
1121
- syms = []
1120
+ expls : List [ ast . expr ] = []
1121
+ syms : List [ ast . expr ] = []
1122
1122
results = [left_res ]
1123
1123
for i , op , next_operand in it :
1124
1124
if (
0 commit comments