@@ -71,29 +71,24 @@ async def typing_update(
7171 return 2 , filename
7272
7373 # Check for unused imports (autoflake)
74- try :
75- await loop .run_in_executor (
76- None , autoflake_partial ,
77- [None , '-c' , filename ],
78- )
79- if (
80- args .keep_updates is False
81- and args .full_reorder is False
82- and FileStatus .COMMENT_TYPING not in file_status
83- ):
84- # -> No unused imports, revert changes
85- return 2 , filename
86- except SystemExit :
87- pass
74+ status_autoflake = await loop .run_in_executor (
75+ None , autoflake_partial ,
76+ [None , '-c' , filename ],
77+ )
78+ if (
79+ status_autoflake == 0
80+ and args .keep_updates is False
81+ and args .full_reorder is False
82+ and FileStatus .COMMENT_TYPING not in file_status
83+ ):
84+ # -> No unused imports, revert changes
85+ return 2 , filename
8886
8987 # Remove unused imports (autoflake)
90- try :
91- await loop .run_in_executor (
92- None , autoflake_partial ,
93- [None , '-i' , filename ],
94- )
95- except SystemExit :
96- pass
88+ await loop .run_in_executor (
89+ None , autoflake_partial ,
90+ [None , '-i' , filename ],
91+ )
9792
9893 # Run isort
9994 try :
0 commit comments