@@ -118,22 +118,29 @@ def import_if_exists(module_name, silent_fail=False):
118118
119119
120120def _module_exists_in_some_zip_path (module_name ):
121+ '''
122+ Return whether a module by the name `module_name` exists in a zip archive.
123+
124+ Used internally by `exists`.
125+ '''
121126 assert '.' not in module_name
122127
123128 zip_paths = [path for path in sys .path if '.zip' in path ]
124129 # todo: Find better way to filter zip paths.
125130
126131 for zip_path in zip_paths :
127132
128- # Trying to create a zip imported :
133+ # Trying to create a zip importer :
129134 try :
130135 zip_importer = zipimport .zipimporter (zip_path )
131136 except zipimport .ZipImportError :
132137 continue
133138 # Excepted `ZipImportError` because we may have zip paths in
134139 # `sys.path` that don't really exist, which causes `zipimport` to
135- # raise `ZipImportError`. todo: should find smarter way of catching
136- # this, excepting `ZipImportError` is not a good idea.
140+ # raise `ZipImportError`.
141+ #
142+ # todo: should find smarter way of catching this, excepting
143+ # `ZipImportError` is not a good idea.
137144
138145 if zip_importer .find_module (module_name ) is not None :
139146 return True
@@ -151,7 +158,7 @@ def exists(module_name):
151158
152159 Currently implemented for top-level packages only. (i.e. no dots.)
153160
154- ( Supports modules imported from a zip file.)
161+ Supports modules imported from a zip file.
155162 '''
156163 assert '.' not in module_name
157164 try :
0 commit comments