Try to find a spec for 'fullname' on sys.path or 'path'. The search is based on sys.path_hooks and sys.path_importer_cache.
(cls, fullname, path=None, target=None)
| 1283 | |
| 1284 | @classmethod |
| 1285 | def find_spec(cls, fullname, path=None, target=None): |
| 1286 | """Try to find a spec for 'fullname' on sys.path or 'path'. |
| 1287 | |
| 1288 | The search is based on sys.path_hooks and sys.path_importer_cache. |
| 1289 | """ |
| 1290 | if path is None: |
| 1291 | path = sys.path |
| 1292 | spec = cls._get_spec(fullname, path, target) |
| 1293 | if spec is None: |
| 1294 | return None |
| 1295 | elif spec.loader is None: |
| 1296 | namespace_path = spec.submodule_search_locations |
| 1297 | if namespace_path: |
| 1298 | # We found at least one namespace path. Return a spec which |
| 1299 | # can create the namespace package. |
| 1300 | spec.origin = None |
| 1301 | spec.submodule_search_locations = _NamespacePath(fullname, namespace_path, cls._get_spec) |
| 1302 | return spec |
| 1303 | else: |
| 1304 | return None |
| 1305 | else: |
| 1306 | return spec |
| 1307 | |
| 1308 | @staticmethod |
| 1309 | def find_distributions(*args, **kwargs): |
no test coverage detected