@@ -1018,9 +1018,7 @@ def visit_BoolOp(self, boolop: ast.BoolOp) -> tuple[ast.Name, str]:
10181018 ]
10191019 ):
10201020 pytest_temp = self .variable ()
1021- self .variables_overwrite [self .scope ][
1022- v .left .target .id
1023- ] = v .left # type:ignore[assignment]
1021+ self .variables_overwrite [self .scope ][v .left .target .id ] = v .left # type:ignore[assignment]
10241022 v .left .target .id = pytest_temp
10251023 self .push_format_context ()
10261024 res , expl = self .visit (v )
@@ -1064,19 +1062,15 @@ def visit_Call(self, call: ast.Call) -> tuple[ast.Name, str]:
10641062 if isinstance (arg , ast .Name ) and arg .id in self .variables_overwrite .get (
10651063 self .scope , {}
10661064 ):
1067- arg = self .variables_overwrite [self .scope ][
1068- arg .id
1069- ] # type:ignore[assignment]
1065+ arg = self .variables_overwrite [self .scope ][arg .id ] # type:ignore[assignment]
10701066 res , expl = self .visit (arg )
10711067 arg_expls .append (expl )
10721068 new_args .append (res )
10731069 for keyword in call .keywords :
10741070 if isinstance (
10751071 keyword .value , ast .Name
10761072 ) and keyword .value .id in self .variables_overwrite .get (self .scope , {}):
1077- keyword .value = self .variables_overwrite [self .scope ][
1078- keyword .value .id
1079- ] # type:ignore[assignment]
1073+ keyword .value = self .variables_overwrite [self .scope ][keyword .value .id ] # type:ignore[assignment]
10801074 res , expl = self .visit (keyword .value )
10811075 new_kwargs .append (ast .keyword (keyword .arg , res ))
10821076 if keyword .arg :
@@ -1113,13 +1107,9 @@ def visit_Compare(self, comp: ast.Compare) -> tuple[ast.expr, str]:
11131107 if isinstance (
11141108 comp .left , ast .Name
11151109 ) and comp .left .id in self .variables_overwrite .get (self .scope , {}):
1116- comp .left = self .variables_overwrite [self .scope ][
1117- comp .left .id
1118- ] # type:ignore[assignment]
1110+ comp .left = self .variables_overwrite [self .scope ][comp .left .id ] # type:ignore[assignment]
11191111 if isinstance (comp .left , ast .NamedExpr ):
1120- self .variables_overwrite [self .scope ][
1121- comp .left .target .id
1122- ] = comp .left # type:ignore[assignment]
1112+ self .variables_overwrite [self .scope ][comp .left .target .id ] = comp .left # type:ignore[assignment]
11231113 left_res , left_expl = self .visit (comp .left )
11241114 if isinstance (comp .left , (ast .Compare , ast .BoolOp )):
11251115 left_expl = f"({ left_expl } )"
@@ -1137,9 +1127,7 @@ def visit_Compare(self, comp: ast.Compare) -> tuple[ast.expr, str]:
11371127 and next_operand .target .id == left_res .id
11381128 ):
11391129 next_operand .target .id = self .variable ()
1140- self .variables_overwrite [self .scope ][
1141- left_res .id
1142- ] = next_operand # type:ignore[assignment]
1130+ self .variables_overwrite [self .scope ][left_res .id ] = next_operand # type:ignore[assignment]
11431131 next_res , next_expl = self .visit (next_operand )
11441132 if isinstance (next_operand , (ast .Compare , ast .BoolOp )):
11451133 next_expl = f"({ next_expl } )"
0 commit comments