instantiate a plugin
        creates the object, stores it in _instance
182952
def new_plugin(self, config, *args, **kwargs):
        
        typ = None
        obj = None

        # if type is defined, create a new instance
        if 'type' in config:
            typ = config['type']

        # single key is overriding an existing plugin instance
        elif isinstance(config, collections.Mapping) and len(config) == 1:
            # get type name and shift out config to parent level
            (typ, config) = list(config.items())[0]

        obj = self._ctor(typ, config, *args, **kwargs)

        # store if named
        if 'name' in config:
            self._instance[config['name']] = obj
        else:
            # this could dupe on .name, make name=''?
            config['name'] = typ

        return obj
18866
def add_plugin(self, plugin, call):
        
        meth = getattr(plugin, call, None)
        if meth is not None:
            self.plugins.append((plugin, meth))
643403
def loadInstance(self):
        
        if self._loaded:
            return

        self._loaded = True
        module_path = self.modulePath()

        package = projex.packageFromPath(module_path)
        path = os.path.normpath(projex.packageRootPath(module_path))

        if path in sys.path:
            sys.path.remove(path)

        sys.path.insert(0, path)

        try:
            __import__(package)

        except Exception, e:
            err = Plugin(self.name(), self.version())
            err.setError(e)
            err.setFilepath(module_path)

            self._instance = err

            self.setError(e)

            msg = "%s.plugin('%s') errored loading instance from %s"
            opts = (self.proxyClass().__name__, self.name(), module_path)
            logger.warning(msg % opts)
            logger.error(e)
292071
def GetPluginObjectByName(cls, plugin_name):
    
    plugin_class = cls._plugin_classes.get(plugin_name, None)
    if plugin_class:
      return plugin_class()

    return None
1373704
def instantiate(self, seed=0, serial_id=0, preset='default', extra_args=None) -> gym.Env:
        
        settings = self.get_preset(preset)
        return wrapped_env_maker(self.envname, seed, serial_id, **settings)
47218
def register( cls, plugin ):
        
        if ( not plugin ):
            return
            
        if ( cls._plugins is None ):
            cls._plugins = {}
            
        cls._plugins[plugin.uniqueName()] = plugin
899318
function init(pluginInterface) {
    pi = pluginInterface;
    log = pi.log;
    localStorage = pi.localStorage;

    pollLog = localStorage.getItem('pollLog', []);

    resetPolling();
}
676636
private static <T> T instantiateObject(
      String flagName,
      String objectType,
      Class<T> clazz,
      PluginLoader loader,
      String instanceClassName) {
    try {
      return loader.loadPlugin(instanceClassName).asSubclass(clazz).getConstructor().newInstance();
    } catch (ClassCastException cce) {
      throw new CommandLineError(
          String.format(
              "%s \"%s\" is not a subclass of %s.  Classes passed to %s should be %ss. "
                  + "Did you pass it to the wrong flag?",
              objectType,
              instanceClassName,
              clazz.getSimpleName(),
              flagName,
              clazz.getSimpleName()),
          cce);
    } catch (ReflectiveOperationException e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s.  Please make "
                  + "sure that the %s exists and is on the compiler classpath and has a public "
                  + "zero arguments constructor.",
              objectType, instanceClassName, flagName, objectType),
          e);
    } catch (ExceptionInInitializerError e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s. An error was thrown while "
                  + "loading the class.  There is a bug in the implementation.",
              objectType, instanceClassName, flagName),
          e);
    } catch (SecurityException e) {
      throw new CommandLineError(
          String.format(
              "Cannot instantiate %s \"%s\" registered with flag %s. A security manager is "
                  + "preventing instantiation.",
              objectType, instanceClassName, flagName),
          e);
    }
  }
1166800
def _instance_parser(self, plugins):
        
        plugins = util.return_list(plugins)
        for instance in plugins:
            if inspect.isclass(instance):
                self._handle_class_instance(instance)
            else:
                self._handle_object_instance(instance)
1135008
def create(self, **kwargs):
        
        obj = self.model(**kwargs)
        obj.save(force_insert=True, using=self._using)
        return obj
84946
function _getInstance (element, options) {
  let machine;
  if (!$.data(element[0], 'plugin_' + name)) {
    machine = new JQuerySlotMachine(element[0], options);
    $.data(element[0], 'plugin_' + name, machine);
  } else {
    machine = $.data(element[0], 'plugin_' + name);
  }
  return machine;
}
376678
def instantiate(params)
      instance = Instance.new( *interpolate(params), @parent )
      instance.apply_resource_type
      instance
    end
970100
function newInstance(extend) {
  return (initialValues = {}) => {
    const model = {};
    const publicAPI = {};
    extend(publicAPI, model, initialValues);
    return Object.freeze(publicAPI);
  };
}
8477
def create(self, **kwargs):
        
        obj = self.model(**kwargs)
        meta = obj.get_meta()
        meta.connection = get_es_connection(self.es_url, self.es_kwargs)
        meta.index=self.index
        meta.type=self.type
        obj.save(force=True)
        return obj
364547
def instantiate_by_name_with_default(self, object_name, default_value=None):
        
        if object_name not in self.instances:
            if object_name not in self.environment:
                return default_value
            else:
                instance = self.instantiate_from_data(self.environment[object_name])

                self.instances[object_name] = instance
                return instance
        else:
            return self.instances[object_name]
656763
def instance(self, *args, **kwargs):
        
        mod, cls = self.get_module_class()
        inst = cls(*args, **kwargs)
        logger.debug(f'inst: {inst}')
        return inst
928815
public static function get_instance( $plugin_name, $plugin_file, $slug_name = null ) {
		if ( ! isset( self::$_instances[ $plugin_name ] ) ) {
			$instances                        = new static( $plugin_name, $plugin_file, $slug_name );
			self::$_instances[ $plugin_name ] = $instances;

			$latest  = self::$_latest_library_version;
			$version = $instances->_library_version;
			if ( ! isset( $latest ) || version_compare( $latest, $version, '<' ) ) {
				self::$_latest_library_version   = $version;
				self::$_latest_library_directory = $instances->_library_directory;
			}
		}

		return self::$_instances[ $plugin_name ];
	}