def __init__(self): # TODO cache directory content for faster module lookup without file system access. # Find the platform specific suffix. On Windows it is .pyd, on Linux/Unix .so. for ext, mode, typ in imp.get_suffixes(): if typ == imp.C_EXTENSION: self._c_ext_tuple = (ext, mode, typ) self._suffix = ext # Just string like .pyd or .so break # Create hashmap of directory content for better performance. files = pyi_os_path.os_listdir(sys.prefix) self._file_cache = set(files)
def __init__(self): # TODO cache directory content for faster module lookup without file system access. # Create set() of directory content for better performance. # This cache avoids any file-system access. files = pyi_os_path.os_listdir(SYS_PREFIX) self._file_cache = set(files)