def _split_path_to_module(path): moddir, modfile = os.path.split(abspath(path)) modname = os.path.splitext(modfile)[0] return moddir, modname
def _get_module_source(module): source = getattr(module, '__file__', None) return abspath(source) if source else '<unknown>'