MCPcopy Index your code
hub / github.com/python/cpython / listmodules

Method listmodules

Lib/idlelib/pathbrowser.py:82–99  ·  view source on GitHub ↗
(self, allnames)

Source from the content-addressed store, hash-verified

80 return os.path.exists(init)
81
82 def listmodules(self, allnames):
83 modules = {}
84 suffixes = importlib.machinery.EXTENSION_SUFFIXES[:]
85 suffixes += importlib.machinery.SOURCE_SUFFIXES
86 suffixes += importlib.machinery.BYTECODE_SUFFIXES
87 sorted = []
88 for suff in suffixes:
89 i = -len(suff)
90 for name in allnames[:]:
91 normed_name = os.path.normcase(name)
92 if normed_name[i:] == suff:
93 mod_name = name[:i]
94 if mod_name not in modules:
95 modules[mod_name] = None
96 sorted.append((normed_name, name))
97 allnames.remove(name)
98 sorted.sort()
99 return sorted
100
101
102if __name__ == "__main__":

Callers 1

GetSubListMethod · 0.95

Calls 4

normcaseMethod · 0.80
appendMethod · 0.45
removeMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected