File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -139,15 +139,25 @@ def load_module(self, fullname):
139139 for old_path , new_paths in file_map .items ():
140140 if old_path .suffix not in ("" , ".py" ) or not "hexrd" in old_path .parts :
141141 continue
142- if path_to_module (old_path ) == fullname :
142+ try :
143+ old_mod = path_to_module (old_path )
144+ except ValueError :
145+ continue
146+
147+ if old_mod == fullname or old_mod .startswith (fullname + "." ):
143148 for p in new_paths :
144149 candidate = path_to_module (p )
145150 if candidate != mapped_module :
146151 extra_candidates .append (candidate )
147- break
148152
149153 if extra_candidates :
150- for candidate in extra_candidates :
154+ seen = set ()
155+ deduped : list [str ] = []
156+ for c in extra_candidates :
157+ if c not in seen :
158+ seen .add (c )
159+ deduped .append (c )
160+ for candidate in deduped :
151161 try :
152162 cand_mod = importlib .import_module (candidate )
153163 except Exception :
You can’t perform that action at this time.
0 commit comments