@@ -216,8 +216,11 @@ def topological_sort_based_on_dependencies(pkg_paths: list[str]) -> list[str]:
216
216
for path in sorted (module_set .by_path .keys ()):
217
217
module_name = "." .join (module_set .by_path [path ].fqn )
218
218
mod = module_set .by_name [module_name ]
219
- imports = module_set .get_imports (mod )
220
- import_dependencies [path ] = set ([str (x ) for x in imports ])
219
+ try :
220
+ imports = module_set .get_imports (mod )
221
+ import_dependencies [path ] = set ([str (x ) for x in imports ])
222
+ except Exception :
223
+ import_dependencies [path ] = set ()
221
224
222
225
import_dependencies_files = ignore_cycles (import_dependencies )
223
226
@@ -236,14 +239,15 @@ def get_target_edit_files(
236
239
files = _find_files_to_edit (target_dir , src_dir , test_dir )
237
240
filtered_files = []
238
241
for file_path in files :
239
- with open (file_path , "r" , encoding = "utf-8" , errors = "ignore" ) as file :
242
+ with open (file_path , "r" , encoding = "utf-8-sig " , errors = "ignore" ) as file :
240
243
content = file .read ()
241
244
if len (content .splitlines ()) > 1500 :
242
245
continue
243
246
if " pass" in content :
244
247
filtered_files .append (file_path )
245
248
# Change to reference commit to get the correct dependencies
246
249
local_repo .git .checkout (reference_commit )
250
+
247
251
topological_sort_files = topological_sort_based_on_dependencies (filtered_files )
248
252
if len (topological_sort_files ) != len (filtered_files ):
249
253
if len (topological_sort_files ) < len (filtered_files ):
0 commit comments