

def getmoduleinfo(path):
    'Get the module name, suffix, mode, and module type for a given file.'
    filename = os.path.basename(path)

    def _f(suffix, mode, mtype):
        return ((- len(suffix)), suffix, mode, mtype)
    suffixes = map(_f, imp.get_suffixes())
    suffixes.sort()
    for (neglen, suffix, mode, mtype) in suffixes:
        if (filename[neglen:] == suffix):
            return (filename[:neglen], suffix, mode, mtype)

dataset/ETHPy150Open cournape/Bento/bento/compat/inspect.py getmoduleinfo/original