@@ -190,9 +190,17 @@ def import_by_path(path, name=None, keep_in_sys_modules=True):
190190
191191def find_module (module_name , path = None , look_in_zip = True , legacy_output = False ):
192192 '''
193- blocktododoc
193+ Search for a module by name and return its filename.
194194
195- Gives funky output when `legacy_output=True and look_in_zip=True`.
195+ When `path=None`, search for a built-in, frozen or special module and
196+ continue search in `sys.path`.
197+
198+ When `legacy_output=True`, instead of returning the module's filename,
199+ returns a tuple `(file, filename, (suffix, mode, type))`.
200+
201+ When `look_in_zip=True`, also looks in zipmodules.
202+
203+ todo: Gives funky output when `legacy_output=True and look_in_zip=True`.
196204 '''
197205 # todo: test
198206 if look_in_zip :
@@ -213,7 +221,7 @@ def find_module(module_name, path=None, look_in_zip=True, legacy_output=False):
213221
214222 if legacy_output :
215223 return result
216- else : # not legacy_output
224+ else : # legacy_output is False
217225 file_ , path_ , description_ = result
218226 if file_ is not None :
219227 file_ .close ()
@@ -222,9 +230,9 @@ def find_module(module_name, path=None, look_in_zip=True, legacy_output=False):
222230
223231def _find_module_in_some_zip_path (module_name , path = None ):
224232 '''
225- Return whether a module by the name `module_name` exists in a zip archive.
226- blocktododoc
227- Used internally by `exists `.
233+ If a module called `module_name` exists in a zip archive, get its path .
234+
235+ If the module is not found, raises `ImportError `.
228236 '''
229237 original_path_argument = path
230238
@@ -276,4 +284,10 @@ def _find_module_in_some_zip_path(module_name, path=None):
276284
277285
278286def _module_address_to_partial_path (module_address ):
287+ '''
288+ Convert a dot-seperated address to a path-seperated address.
289+
290+ For example, on Linux, `'python_toolbox.caching.cached_property'` would be
291+ converted to `'python_toolbox/caching/cached_property'`.
292+ '''
279293 return os .path .sep .join (module_address .split ('.' ))
0 commit comments