find_loader(fullname, path=None) -> self, str or None. Search for a module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the zipimporter instance itself if the module was found, a string containing the full path
(self, fullname, path=None)
| 107 | # full path if it's a possible namespace portion, None if we |
| 108 | # can't load it. |
| 109 | def find_loader(self, fullname, path=None): |
| 110 | """find_loader(fullname, path=None) -> self, str or None. |
| 111 | |
| 112 | Search for a module specified by 'fullname'. 'fullname' must be the |
| 113 | fully qualified (dotted) module name. It returns the zipimporter |
| 114 | instance itself if the module was found, a string containing the |
| 115 | full path name if it's possibly a portion of a namespace package, |
| 116 | or None otherwise. The optional 'path' argument is ignored -- it's |
| 117 | there for compatibility with the importer protocol. |
| 118 | |
| 119 | Deprecated since Python 3.10. Use find_spec() instead. |
| 120 | """ |
| 121 | _warnings.warn("zipimporter.find_loader() is deprecated and slated for " |
| 122 | "removal in Python 3.12; use find_spec() instead", |
| 123 | DeprecationWarning) |
| 124 | mi = _get_module_info(self, fullname) |
| 125 | if mi is not None: |
| 126 | # This is a module or package. |
| 127 | return self, [] |
| 128 | |
| 129 | # Not a module or regular package. See if this is a directory, and |
| 130 | # therefore possibly a portion of a namespace package. |
| 131 | |
| 132 | # We're only interested in the last path component of fullname |
| 133 | # earlier components are recorded in self.prefix. |
| 134 | modpath = _get_module_path(self, fullname) |
| 135 | if _is_dir(self, modpath): |
| 136 | # This is possibly a portion of a namespace |
| 137 | # package. Return the string representing its path, |
| 138 | # without a trailing separator. |
| 139 | return None, [f'{self.archive}{path_sep}{modpath}'] |
| 140 | |
| 141 | return None, [] |
| 142 | |
| 143 | |
| 144 | # Check whether we can satisfy the import of the module named by |
no test coverage detected