Gets or creates an instance of type <_type>
169624
def _get_or_create_a(self, _type):
        
        self.l.debug("get_or_create_a: %s" % _type)
        stack = [Manager.GoCa_Plan(self, {_type: ()})]
        while stack:
            p = stack.pop()
            if p.finished:
                p.execute()
                return p.get_a(_type)
            for c in p.branches():
                stack.append(c)
        raise NotImplementedError
1342033
function get(type) {
    return hOP.call(_, type) ?
      _[type] :
      (_[type] = {
        args: null,
        cb: []
      });
  }
593657
function getType(key, req) {
  var val = this.getKey(key, req);
  if(val === undefined) return undefined;
  return val.rtype || TYPE_NAMES.STRING;
}
776860
def create_instance(self, plugin_type, plugin_name, **instance_kwargs):
        """"""
        plugin_type = self._get_plugin_type(plugin_type)
        return plugin_type.create_instance(plugin_name, **instance_kwargs)
746950
def get(self, _create=False, **ctx_options):
        
        if _create:
            return self._kind_factory.create(key=self)
        else:
            return self._kind_factory(key=self)
234198
def extern_get_type_for(self, context_handle, val):
    """"""
    c = self._ffi.from_handle(context_handle)
    obj = self._ffi.from_handle(val[0])
    type_id = c.to_id(type(obj))
    return TypeId(type_id)
113787
def create(self, type_, **kwargs):
        
        obj = self.factory.create("ns0:%s" % type_)
        for key, value in kwargs.items():
            setattr(obj, key, value)
        return obj
1261426
def of_type(cls, iterable, types):
    

    return cls(x for x in iterable if isinstance(x, types))
841256
function extract(type) {
			for(var index = 0; index < 3; index++) {
				if (typeof args[index] === type) { return args[index]; }
			}
		}
382426
@SuppressWarnings("rawtypes")
	public static Object instantiate(Class<?> type) throws Exception {
		if (type.isAssignableFrom(ArrayList.class))
			return new ArrayList();
		if (type.isAssignableFrom(LinkedList.class))
			return new LinkedList();
		if (type.isAssignableFrom(HashSet.class))
			return new HashSet();
		if (type.isAssignableFrom(HashMap.class))
			return new HashMap();
		return type.newInstance();
	}
486203
def _get_a(self, _type):
        
        tmp = self._get_all(_type)
        ret = pick(tmp)
        if len(tmp) != 1:
            self.l.warn(("get_a: %s all implement %s; " +
                         "picking %s") % (tmp, _type, ret))
        return ret
1177609
public static String getExample(TypeDeclaration type) {
		if (type == null || type.example() == null) {
			return null;
		} else {
			return type.example().value();
		}
	}
974134
def _create_type(self, env, item):
        """"""
        if item.name in env:
            existing_dt = env[item.name]
            raise InvalidSpec(
                'Symbol %s already defined (%s:%d).' %
                (quote(item.name), existing_dt._ast_node.path,
                 existing_dt._ast_node.lineno), item.lineno, item.path)
        namespace = self.api.ensure_namespace(env.namespace_name)
        if isinstance(item, AstStructDef):
            try:
                api_type = Struct(name=item.name, namespace=namespace,
                                  ast_node=item)
            except ParameterError as e:
                raise InvalidSpec(
                    'Bad declaration of %s: %s' % (quote(item.name), e.args[0]),
                    item.lineno, item.path)
        elif isinstance(item, AstUnionDef):
            api_type = Union(
                name=item.name, namespace=namespace, ast_node=item,
                closed=item.closed)
        else:
            raise AssertionError('Unknown type definition %r' % type(item))

        env[item.name] = api_type
        return api_type
604665
public <T> T createInstance(Class<T> type) {
        try {
            return type.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new IllegalArgumentException("Cannot create instance of class " + type.getName(), e);
        }
    }
156158
@Override
  public <T> T instance(Class<T> type)
  {
    Key<T> key = Key.of(type);

    return instance(key);
  }
50656
def create(self, type_, *args, **kwargs) -> Any:
        
        attribute = type_(self, *args, **kwargs)
        self._table.append(attribute)
        return attribute
387680
@SuppressWarnings("unchecked")
  public static <T> TypeLiteral<T> get(Class<T> type, Type... parameters) {
    return (TypeLiteral<T>) TypeLiteral.get(new ParameterizedTypeImpl(type, parameters));
  }