Load a factory and have it initialize in a particular directory
    :param name: the name of the plugin to load
    :param directory: the directory where the factory will reside
    :return:
10918
def load_factory(name, directory, configuration=None):
    
    for entry_point in pkg_resources.iter_entry_points(ENTRY_POINT):
        if entry_point.name == name:
            factory_class = entry_point.load(require=False)
            return factory_class(directory, configuration)

    raise KeyError
685516
def Dir(self, name, create=True):
        
        return self.fs.Dir(name, self, create)
365130
def load_directory(path)

      unless File.directory?(path)
        raise "Konfig couldn't load because it was unable to access #{ path }. Please make sure the directory exists and has the correct permissions."
      end

      Dir[File.join(path, "*.yml")].each { |f| load_file(f) }
    end
285049
def init(directory=None):
    """"""
    repo = repo_path(directory)
    if os.path.isdir(repo):
        raise RepositoryAlreadyExistsError(directory, repo)

    # Initialize repository with default template
    shutil.copytree(default_template_path, repo)

    message = '"Default presentation content."'
    subprocess.call(['git', 'init', '-q', repo])
    subprocess.call(['git', 'add', '.'], cwd=repo)
    subprocess.call(['git', 'commit', '-q', '-m', message], cwd=repo)

    return repo
248094
def create_directory(directory):
    
    try:
        os.makedirs(directory)
    except OSError, e:
        if e.errno == errno.EEXIST and os.path.isdir(directory):
            pass

    return directory
946635
public static PluginLoader withPluginDirectory(Path pluginsDirectory) throws PluginException {
        if (pluginsDirectory == null) {
            throw new PluginException("Plugins directory can't be null");
        }
        return new PluginLoader(pluginsDirectory);
    }
504420
def _create_node(self, name, factory, directory=None, create=1):
        
        import SCons.Util
        node = factory(name, directory, create)
        node.set_noclean(self.noclean)
        node.set_precious(self.precious)
        if self.nodefault:
            self.env.Ignore('.', node)
        if self.alias:
            self.env.AlwaysBuild(self.env.Alias(self.alias, node))
        return node
1183897
function(name, root) {
    this.name = name || null;
    if (root) {
        this.root = new DirectoryEntry(root.name, root.fullPath, this);
    }
}
569449
def from_directory_import(
        self,
        module,
        real_names,
        local_names,
        import_alias_mapping,
        skip_init=False
    ):
        
        module_path = module[1]

        init_file_location = os.path.join(module_path, '__init__.py')
        init_exists = os.path.isfile(init_file_location)

        if init_exists and not skip_init:
            package_name = os.path.split(module_path)[1]
            return self.add_module(
                module=(module[0], init_file_location),
                module_or_package_name=package_name,
                local_names=local_names,
                import_alias_mapping=import_alias_mapping,
                is_init=True,
                from_from=True
            )
        for real_name in real_names:
            full_name = os.path.join(module_path, real_name)
            if os.path.isdir(full_name):
                new_init_file_location = os.path.join(full_name, '__init__.py')
                if os.path.isfile(new_init_file_location):
                    self.add_module(
                        module=(real_name, new_init_file_location),
                        module_or_package_name=real_name,
                        local_names=local_names,
                        import_alias_mapping=import_alias_mapping,
                        is_init=True,
                        from_from=True,
                        from_fdid=True
                    )
                else:
                    raise Exception('from anything import directory needs an __init__.py file in directory')
            else:
                file_module = (real_name, full_name + '.py')
                self.add_module(
                    module=file_module,
                    module_or_package_name=real_name,
                    local_names=local_names,
                    import_alias_mapping=import_alias_mapping,
                    from_from=True
                )
        return IgnoredNode()
641552
def load(self, name=None, *args, **kwargs):
        ""
        inst = self.stash.load(name)
        if inst is None:
            inst = self.instance(name, *args, **kwargs)
        logger.debug(f'loaded (conf mng) instance: {inst}')
        return inst
753333
def load_module(self, module_name, path=None):
        ''''''
        self.ensure_started()
        if path is None:
            path = sys.path
        mod = self.client.call(_load_module, module_name, path)
        mod.__isolation_context__ = self
        return mod
1014230
def getPluginDescriptor(self, dir):
		
		for plugin in glob.glob(os.path.join(dir, '*.uplugin')):
			return os.path.realpath(plugin)
		
		# No plugin detected
		raise UnrealManagerException('could not detect an Unreal plugin in the current directory')
17130
def set_cache_dir(directory):
    
    global cache_dir

    if directory is None:
        cache_dir = None
        return

    if not os.path.exists(directory):
        os.makedirs(directory)
    if not os.path.isdir(directory):
        raise ValueError("not a directory")
    cache_dir = directory
509439
def new_dir(self, name):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record already initialized')

        # Zero for the parent dir num is bogus, but that will get fixed later.
        self._new(name, 0)
930534
def step_a_new_working_directory(context):
    
    command_util.ensure_context_attribute_exists(context, "workdir", None)
    command_util.ensure_workdir_exists(context)
    shutil.rmtree(context.workdir, ignore_errors=True)
1269906
def setupViewletByName(self, name):
        
        context = aq_inner(self.context)
        request = self.request

        # Perform viewlet regisration look-up
        # from adapters registry
        reg = self.getViewletByName(name)
        if reg is None:
            return None

        # factory method is responsible for creating the viewlet instance
        factory = reg.factory

        # Create viewlet and put it to the acquisition chain
        # Viewlet need initialization parameters: context, request, view
        try:
            viewlet = factory(context, request, self, None).__of__(context)
        except TypeError:
            # Bad constructor call parameters
            raise RuntimeError(
                "Unable to initialize viewlet {}. "
                "Factory method {} call failed."
                .format(name, str(factory)))

        return viewlet
735155
public static synchronized void setResourcesDirectory(String directory)
    {
        if (directory == null)
        {
            resourcesDir = Constant.EMPTY_STRING + getSeparator();
        }
        else
        {
            resourcesDir = directory + getSeparator();
        }
        loader = Optional.empty();
    }