@@ -1278,19 +1278,22 @@ def fix_e721(self, result):
12781278 # * type("") != type(b) -> (None, None, '""', '!=')
12791279 start = match .start ()
12801280 end = match .end ()
1281+ _prefix = ""
1282+ _suffix = ""
12811283 first_match_type_obj = match .groups ()[1 ]
12821284 if first_match_type_obj is None :
12831285 _target_obj = match .groups ()[2 ]
12841286 else :
12851287 _target_obj = match .groups ()[1 ]
1288+ _suffix = target [end :]
12861289
1287- isinstance_stmt = "isinstance"
1288- is_not_condition = match .groups ()[0 ] == "!=" or match .groups ()[3 ] == "!="
1290+ isinstance_stmt = " isinstance"
1291+ is_not_condition = (
1292+ match .groups ()[0 ] == "!=" or match .groups ()[3 ] == "!="
1293+ )
12891294 if is_not_condition :
1290- isinstance_stmt = "not isinstance"
1295+ isinstance_stmt = " not isinstance"
12911296
1292- _prefix = ""
1293- _suffix = ""
12941297 _type_comp = f"{ _target_obj } , { target [:start ]} "
12951298
12961299 _prefix_tmp = target [:start ].split ()
@@ -1312,10 +1315,7 @@ def fix_e721(self, result):
13121315 cmp_b = _suffix_type_match .groups ()[0 ]
13131316 _type_comp = f"{ _target_obj } , { cmp_b } "
13141317
1315- if first_match_type_obj is None :
1316- fix_line = f"{ _prefix } { isinstance_stmt } ({ _type_comp } ){ _suffix } "
1317- else :
1318- fix_line = f"{ _prefix } { isinstance_stmt } ({ _type_comp } ){ target [end :]} "
1318+ fix_line = f"{ _prefix } { isinstance_stmt } ({ _type_comp } ){ _suffix } "
13191319 self .source [line_index ] = fix_line
13201320
13211321 def fix_e722 (self , result ):
0 commit comments