def listmodules(self, allnames):
modules = {}
suffixes = imp.get_suffixes()
sorted = []
for suff, mode, flag in suffixes:
i = -len(suff)
for name in allnames[:]:
normed_name = os.path.normcase(name)
if normed_name[i:] == suff:
mod_name = name[:i]
if mod_name not in modules:
modules[mod_name] = None
sorted.append((normed_name, name))
allnames.remove(name)
sorted.sort()
return sorted
评论列表
文章目录