(self, m)
| 267 | raise ImportError("No module named " + subname) |
| 268 | |
| 269 | def find_all_submodules(self, m): |
| 270 | if not m.__path__: |
| 271 | return |
| 272 | modules = {} |
| 273 | # 'suffixes' used to be a list hardcoded to [".py", ".pyc"]. |
| 274 | # But we must also collect Python extension modules - although |
| 275 | # we cannot separate normal dlls from Python extensions. |
| 276 | suffixes = [] |
| 277 | suffixes += importlib.machinery.EXTENSION_SUFFIXES[:] |
| 278 | suffixes += importlib.machinery.SOURCE_SUFFIXES[:] |
| 279 | suffixes += importlib.machinery.BYTECODE_SUFFIXES[:] |
| 280 | for dir in m.__path__: |
| 281 | try: |
| 282 | names = os.listdir(dir) |
| 283 | except OSError: |
| 284 | self.msg(2, "can't list directory", dir) |
| 285 | continue |
| 286 | for name in names: |
| 287 | mod = None |
| 288 | for suff in suffixes: |
| 289 | n = len(suff) |
| 290 | if name[-n:] == suff: |
| 291 | mod = name[:-n] |
| 292 | break |
| 293 | if mod and mod != "__init__": |
| 294 | modules[mod] = mod |
| 295 | return modules.keys() |
| 296 | |
| 297 | def import_module(self, partname, fqname, parent): |
| 298 | self.msgin(3, "import_module", partname, fqname, parent) |
no test coverage detected