Returns a Type instance by name.
 This will load the type if not already defined.
 @param [String, Symbol] name of the wanted Type
 @return [Puppet::Type, nil] the type or nil if the type was not defined and could not be loaded
174241
def type(name)
    # Avoid loading if name obviously is not a type name
    if name.to_s.include?(':')
      return nil
    end

    @types ||= {}

    # We are overwhelmingly symbols here, which usually match, so it is worth
    # having this special-case to return quickly.  Like, 25K symbols vs. 300
    # strings in this method. --daniel 2012-07-17
    return @types[name] if @types.include? name

    # Try mangling the name, if it is a string.
    if name.is_a? String
      name = name.downcase.intern
      return @types[name] if @types.include? name
    end
    # Try loading the type.
    if typeloader.load(name, Puppet.lookup(:current_environment))
      #TRANSLATORS 'puppet/type/%{name}' should not be translated
      Puppet.warning(_("Loaded puppet/type/%{name} but no class was created") % { name: name }) unless @types.include? name
    elsif !Puppet[:always_retry_plugins]
      # PUP-5482 - Only look for a type once if plugin retry is disabled
      @types[name] = nil
    end

    # ...and I guess that is that, eh.
    return @types[name]
  end
1272043
function requireTypeByName(typeName) {
    var type = typeByName[typeName];
    if (!type) {
        var msg = 'Unable to retrieve a Type by Name [' + typeName + ']';
        registryLogger.error(msg);
        throw new Error(msg);
    }
    if (registryLogger.isDebugEnabled()) {
        registryLogger.debug('Require Type \'%s\' by name [%s]', type.id, typeName);
    }
    return type;
}
966107
def id(type, name)
    res = ids(type, name)

    # hide client endpoints that are not scim compatible
    ik, ck = jkey(:id), jkey(:client_id)
    if type == :client && res && res.length > 0 && (res.length > 1 || res[0][ik].nil?)
      cr = res.find { |o| o[ck] && name.casecmp(o[ck]) == 0 }
      return cr[ik] || cr[ck] if cr
    end

    unless res && res.is_a?(Array) && res.length == 1 &&
        res[0].is_a?(Hash) && (id = res[0][jkey :id])
      raise NotFound, "#{name} not found in #{@target}#{type_info(type, :path)}"
    end
    id
  end
1342145
def expand_resource_type(types)
      output = [types].flatten.map do |t|
        if t.class.to_s =~ /Puppet::Pops::Types/
          to_resource_declaration(t)
        else
          t
        end
      end
      output
    end
787968
def name=(name)
      if name.nil?
        fail ArgumentError, "name cannot be nil"
      end

      if name !~ Regexp.new(/^(?!(.*[\\\"\\*\\\\\\>\\<\\?\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))/)
        fail ArgumentError, "invalid value for 'name', must conform to the pattern /^(?!(.*[\\\"\\*\\\\\\>\\<\\?\/\\:\\|]+.*)|(.*[\\.]?.*[\\.]+$)|(.*[ ]+$))/."
      end

      @name = name
    end
84821
def check_type(type_name)
      alias_name = @rally_alias_types[type_name.downcase.to_s]
      return alias_name unless alias_name.nil?
      return type_name
    end
613712
def instance_get(attribute)
      getter = :"#{self.name}_#{attribute}"
      self.instance.send(getter) if instance.respond_to?(getter)
    end
501881
def instantiate_definition(definition, loader)
    case definition
    when Model::PlanDefinition
      instantiate_PlanDefinition(definition, loader)
    when Model::FunctionDefinition
      instantiate_FunctionDefinition(definition, loader)
    when Model::TypeAlias
      instantiate_TypeAlias(definition, loader)
    when Model::TypeMapping
      instantiate_TypeMapping(definition, loader)
    else
      raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '#{definition.class}'"
    end
  end
1116327
def get(typename):
    
    dt = getPDT(typename) or getCDT(typename)

    if dt is None:
        pdt, nelems = ArrayType.parse(typename)
        if pdt and nelems:
            dt = ArrayType(pdt, nelems)

    return dt
691596
def target_type(target_type)
      return if target_type.nil?
      return unless [String, Symbol].include?(target_type.class)
      target_type = target_type.to_sym if target_type.instance_of? String
      return unless TARGET_TYPES.include? target_type
      @_target_type = target_type
    end
850033
private NameInfo getNameInfoForName(String name, SymbolType type) {
    Map<String, NameInfo> map = type == PROPERTY ? propertyNameInfo : varNameInfo;
    if (map.containsKey(name)) {
      return map.get(name);
    } else {
      NameInfo nameInfo = new NameInfo(name);
      map.put(name, nameInfo);
      symbolGraph.createNode(nameInfo);
      return nameInfo;
    }
  }
824996
def get(provider_name, node_type_name)
      name = "#{provider_name}/#{node_type_name}/"
      response = http_get(resource_url(name))
      format_object(response, TYPE)
    end
1106946
def get_class_by_name( name )
      raise "get_class_by_name #{name}.#{name.class}" unless name.is_a?(Symbol)
      c = classes[name]
      #puts "MISS, no class #{name} #{name.class}" unless c # " #{classes}"
      #puts "CLAZZ, #{name} #{c.get_type.get_length}" if c
      c
    end
57915
protected Type<?> loadType( String name )
    {
        Type<?> type = typeLoader.loadType( name );
        if (type == null) throw new TypeNotFoundException( name , this.getClass());
        return type;
    }
901471
def getTypeDefinition(cls, namespaceURI, name, lazy=False):
        ''' 
        '''
        klass = cls.types.get((namespaceURI, name), None)
        if lazy and klass is not None:
            return _Mirage(klass)
        return klass
465590
def from_type_name(cls, typ, name):
        """"""
        # Try aliases first.
        for k, nt in cls.defined_aliases.items():
            if typ is not None and typ != nt.type: continue
            #print(name, nt.name)
            if name == nt.name:
                if len(k) == 1: return cls(xc=k)
                if len(k) == 2: return cls(x=k[0], c=k[1])
                raise ValueError("Wrong key: %s" % k)

        # At this point, we should have something in the form
        # name="GGA_X_PBE+GGA_C_PBE" or  name=""LDA_XC_TETER93"
        if "+" in name:
            #if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
            x, c = (s.strip() for s in name.split("+"))
            x, c = LibxcFunc[x], LibxcFunc[c]
            return cls(x=x, c=c)
        else:
            #if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
            xc = LibxcFunc[name]
            return cls(xc=xc)

        if typ is None:
            raise ValueError("Cannot find name=%s in defined_aliases" % name)
        else:
            raise ValueError("Cannot find type=%s, name=%s in defined_aliases" % (typ, name))
881533
def get_conf(name)
      env = get(name)
      if env
        Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
      else
        nil
      end
    end