Try and create a reference to a type on MSDN
353005
def get_msdn_ref(name):
    
    in_msdn = False
    if name in MSDN_VALUE_TYPES:
        name = MSDN_VALUE_TYPES[name]
        in_msdn = True
    if name.startswith('System.'):
        in_msdn = True
    if in_msdn:
        link = name.split('<')[0]
        if link in MSDN_LINK_MAP:
            link = MSDN_LINK_MAP[link]
        else:
            link = link.lower()
        url = 'https://msdn.microsoft.com/en-us/library/'+link+'.aspx'
        node = nodes.reference(name, shorten_type(name))
        node['refuri'] = url
        node['reftitle'] = name
        return node
    else:
        return None
1344780
def bind_type(type_to_bind: hexdi.core.restype, accessor: hexdi.core.clstype, lifetime_manager: hexdi.core.ltype):
    
    hexdi.core.get_root_container().bind_type(type_to_bind, accessor, lifetime_manager)
782272
@SuppressWarnings("unchecked")
  private T readReference(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
    ReferencePool<?> pool = pools.get(type);
    if (pool == null) {
      Constructor<?> constructor = constructorMap.get(type);
      if (constructor == null) {
        try {
          constructor = type.getDeclaredConstructor(ReferenceManager.class);
          constructor.setAccessible(true);
          constructorMap.put(type, constructor);
        } catch (NoSuchMethodException e) {
          throw new SerializationException("failed to instantiate reference: must provide a single argument constructor", e);
        }
      }

      pool = new ReferencePool<>(createFactory(constructor));
      pools.put(type, pool);
    }
    T object = (T) pool.acquire();
    object.readObject(buffer, serializer);
    return object;
  }
654300
public static <T> Reference<T> create(ReferenceType type, T referent) {
		return create(type, referent, null);
	}
1160744
public <T> T createLambdaUnchecked(String code, TypeReference<T> type) {
        try {
            return createLambda(code, type);
        } catch (LambdaCreationException e) {
            throw new LambdaCreationRuntimeException(e);
        }
    }
1324594
def converter(type_name):
    """"""
    converter = TYPES.get(type_name)
    if converter is None:
        raise ConverterError('Unknown converter: %r' % type_name)
    return converter()
654228
def type_check(thetype, data, bindings = None):
    
    if not bindings: bindings = Bindings()
    if isinstance(thetype, core.RecordType):
        for name,child in zip(thetype.child_names, thetype.child_types):
            value = data[name]
            type_check(child, value, bindings)
    elif isinstance(thetype, core.TupleType):
        assert isinstance(data, tuple)
        assert len(data) == len(thetype.child_types)
        for value,child_type in zip(data, thetype.child_types):
            type_check(child_type, value, bindings)
    elif isinstance(thetype, core.UnionType):
        assert isinstance(thetype, dict)
        children = [(name,child) for name,child in zip(thetype.child_names, thetype.child_types) if name in data]
        assert len(fields) == 1, "0 or more than 1 entry in Union"
        child_name,child_type = children[0]
        type_check(child_type, data[child_name], bindings)
    elif isinstance(thetype, core.TypeApp):
        # Type applications are tricky.  These will "affect" bindings
        bindings.push()
        for k,v in thetype.param_values.items():
            bindings[k] = v
        type_check(thetype.root_type, data, bindings)
        bindings.pop()
    elif isinstance(thetype, core.TypeVar):
        # Find the binding for this type variable
        bound_type = bindings[thetype.name]
        if bound_type is None:
            raise errors.ValidationError("TypeVar(%s) is not bound to a type." % thetype.name)
        type_check(bound_type, data, bindings)
    elif isinstance(thetype, core.NativeType):
        # Native types are interesting - these can be plain types such as Int, Float etc
        # or they can be generic types like Array<T>, Map<K,V>
        # While plain types are fine, generic types (ie native types with args) pose a problem.
        # How do we perform type checking on "contents" of the data given native types.
        # We need native types to be able to apply mapper functions on data as they see fit.
        # So to deal with custom validations on native types we need
        # native types to expose mapper functors for us!!!
        if thetype.args and thetype.mapper_functor:
            def type_check_functor(*values):
                for arg, value in zip(thetype.args, values):
                    bound_type = bindings[arg]
                    if bound_type is None:
                        raise errors.ValidationError("Arg(%s) is not bound to a type." % arg)
                    type_check(bound_type, value)
            thetype.mapper_functor(type_check_functor, data)

    # Finally apply any other validators that were nominated 
    # specifically for that particular type
    if thetype.validator:
        thetype.validator(thetype, data, bindings)
646348
function (type) {
      var error = Exception.errors.filter(function (item) {
        return item.type === type || item.output === type;
      })[0];

      return error ? error.output : null;
    }
928812
public static void callProc(Object instance, Class<?> type, String methodName, Class<?>[] types, Object... args) {
		try {
			final Method method = type.getDeclaredMethod(methodName, types);
			method.setAccessible(true);
			method.invoke(instance, args);
		} catch (Exception exception) {
			throw new Error(exception);
		}
	}
1211874
def instantiate_from_config(cfg):
    """"""
    for h in cfg:
        if h.get("type") in data_types:
            raise KeyError("Data type '%s' already exists" % h)
        data_types[h.get("type")] = DataType(h)
1207734
public DiscriminatorJdbcSubBuilder when(String value, TypeReference<? extends T> type) {
        return when(value, type.getType());
    }
1211186
def getTypeStr(_type):
  
  """
  if isinstance(_type, CustomType):
    return str(_type)

  if hasattr(_type, '__name__'):
    return _type.__name__

  return ''
1310373
private String genTypeRef(StructureDefinition sd, ElementDefinition ed, String id, ElementDefinition.TypeRefComponent typ) {

    if(typ.hasProfile()) {
      if(typ.getCode().equals("Reference"))
        return genReference("", typ);
      else if(ProfileUtilities.getChildList(sd, ed).size() > 0) {
        // inline anonymous type - give it a name and factor it out
        innerTypes.add(new ImmutablePair<StructureDefinition, ElementDefinition>(sd, ed));
        return simpleElement(sd, ed, id);
      }
      else {
        String ref = getTypeName(typ);
        datatypes.add(ref);
        return simpleElement(sd, ed, ref);
      }

    } else if (typ.getCodeElement().getExtensionsByUrl(ToolingExtensions.EXT_RDF_TYPE).size() > 0) {
      String xt = null;
      try {
        xt = typ.getCodeElement().getExtensionString(ToolingExtensions.EXT_RDF_TYPE);
      } catch (FHIRException e) {
        e.printStackTrace();
      }
      // TODO: Remove the next line when the type of token gets switched to string
      // TODO: Add a rdf-type entry for valueInteger to xsd:integer (instead of int)
      ST td_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE).add("typ",
              xt.replace("xsd:token", "xsd:string").replace("xsd:int", "xsd:integer"));
      StringBuilder facets =  new StringBuilder();
      if(ed.hasMinValue()) {
        Type mv = ed.getMinValue();
        facets.append(tmplt(MINVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
      }
      if(ed.hasMaxValue()) {
        Type mv = ed.getMaxValue();
        facets.append(tmplt(MAXVALUE_TEMPLATE).add("val", mv.primitiveValue()).render());
      }
      if(ed.hasMaxLength()) {
        int ml = ed.getMaxLength();
        facets.append(tmplt(MAXLENGTH_TEMPLATE).add("val", ml).render());
      }
      if(ed.hasPattern()) {
        Type pat = ed.getPattern();
        facets.append(tmplt(PATTERN_TEMPLATE).add("val",pat.primitiveValue()).render());
      }
      td_entry.add("facets", facets.toString());
      return td_entry.render();

    } else if (typ.getCode() == null) {
      ST primitive_entry = tmplt(PRIMITIVE_ELEMENT_DEFN_TEMPLATE);
      primitive_entry.add("typ", "xsd:string");
      return primitive_entry.render();

    } else if(typ.getCode().equals("xhtml")) {
      return tmplt(XHTML_TYPE_TEMPLATE).render();
    } else {
      datatypes.add(typ.getCode());
      return simpleElement(sd, ed, typ.getCode());
    }
  }
1228548
private Referenceable registerInstance(Referenceable referenceable) throws Exception {
        String typeName = referenceable.getTypeName();
        LOG.debug("creating instance of type {}", typeName);

        String entityJSON = InstanceSerialization.toJson(referenceable, true);
        LOG.debug("Submitting new entity {} = {}", referenceable.getTypeName(), entityJSON);
        List<String> guids = getAtlasClient().createEntity(entityJSON);
        LOG.debug("created instance for type {}, guid: {}", typeName, guids);

        return new Referenceable(guids.get(guids.size() - 1), referenceable.getTypeName(), null);
    }
702750
protected static Type getTypeReference(Object type) {
        if (type instanceof Type) {
            return (Type) type;
        } else if (type instanceof Class) {
            return Type.getType((Class) type);
        } else if (type instanceof String) {
            String className = type.toString();

            String internalName = getInternalName(className);
            if (className.endsWith("[]")) {
                internalName = "[L" + internalName + ";";
            }
            return Type.getObjectType(internalName);
        } else {
            throw new IllegalArgumentException("Type reference [" + type + "] should be a Class or a String representing the class name");
        }
    }
1327559
function (type, fn) {
  var result;
  try {
    result = fn();
  }
  catch (e) {
    result = {error: e};
  }

  if (result && !result.type && type)
    result.type = type;

  return result;
}
1123032
public static <T> Reference<T> create(ReferenceType type, T referent, ReferenceQueue<T> queue) {
		switch (type) {
		case SOFT:
			return new SoftReference<>(referent);
		case WEAK:
			return new WeakReference<>(referent);
		case PHANTOM:
			return new PhantomReference<T>(referent, queue);
		default:
			return null;
		}
	}