Convert this type object to an LLVM type.
438716
def _get_ll_pointer_type(self, target_data, context=None):
        
        from . import Module, GlobalVariable
        from ..binding import parse_assembly

        if context is None:
            m = Module()
        else:
            m = Module(context=context)
        foo = GlobalVariable(m, self, name="foo")
        with parse_assembly(str(m)) as llmod:
            return llmod.get_global_variable(foo.name).type
1027529
def _mor_to_pobject(self, mo_ref):
        """"""
        kls = classmapper(mo_ref._type)
        new_object = kls(mo_ref, self)
        return new_object
1113028
private BigInteger toBigInteger(Object value) {
		if (value instanceof Long) {
			return BigInteger.valueOf((Long) value);
		} else if(value instanceof Boolean) {
			return BigInteger.valueOf((boolean)value ? 1 : 0);
		}
		final String valueStr = convertToStr(value);
		if (StrUtil.isBlank(valueStr)) {
			return null;
		}
		return new BigInteger(valueStr);
	}
707540
def from_int(value):
        """"""
        if not isinstance(value, int):
            raise PyVLXException("value_has_to_be_int")
        if not Parameter.is_valid_int(value):
            raise PyVLXException("value_out_of_range")
        return bytes([value >> 8 & 255, value & 255])
217597
def _cast_to_type(self, value):
        
        if isinstance(value, str) or value is None:
            return value
        return str(value)
795943
def to_native(self, obj, name, value):  # pylint:disable=unused-argument
		""""""
		
		if self.mapping:
			for original, new in self.mapping.items():
				value = value.replace(original, new)
		
		return load(value, self.namespace)
1151484
def ConvertFromWireFormat(self, value, container=None):
    """"""
    result = self.type()
    ReadIntoObject(value[2], 0, result)

    return result
1310229
def _convert_labeled_point_to_libsvm(p):
        """"""
        from pyspark.mllib.regression import LabeledPoint
        assert isinstance(p, LabeledPoint)
        items = [str(p.label)]
        v = _convert_to_vector(p.features)
        if isinstance(v, SparseVector):
            nnz = len(v.indices)
            for i in xrange(nnz):
                items.append(str(v.indices[i] + 1) + ":" + str(v.values[i]))
        else:
            for i in xrange(len(v)):
                items.append(str(i + 1) + ":" + str(v[i]))
        return " ".join(items)
1105404
def basicsize(obj, **opts):
    '''
    '''
    v = _typedefof(obj, **opts)
    if v:
        v = v.base
    return v
702365
private static Class<?> typeToClass(Type t)
  {
    if(t instanceof Class<?>) {
      return (Class<?>)t;
    }
    if(t instanceof ParameterizedType) {
      return (Class<?>)((ParameterizedType)t).getRawType();
    }
    throw new BugError("Unknown type %s to convert to class.", t);
  }
935375
def _unionload(l: Loader, value, type_) -> Any:
    
    try:
        args = uniontypes(type_)
    except AttributeError:
        raise TypedloadAttributeError('The typing API for this Python version is unknown')

    # Do not convert basic types, if possible
    if type(value) in args.intersection(l.basictypes):
        return value

    exceptions = []

    # Try all types
    for t in args:
        try:
            return l.load(value, t, annotation=Annotation(AnnotationType.UNION, t))
        except Exception as e:
            exceptions.append(e)
    raise TypedloadValueError(
        'Value could not be loaded into %s' % type_,
            value=value,
            type_=type_,
            exceptions=exceptions
    )
248593
public static BigInteger toBigInteger(Number self) {
        if (self instanceof BigInteger) {
            return (BigInteger) self;
        } else if (self instanceof BigDecimal) {
            return ((BigDecimal) self).toBigInteger();
        } else if (self instanceof Double) {
            return new BigDecimal((Double)self).toBigInteger();
        } else if (self instanceof Float) {
            return new BigDecimal((Float)self).toBigInteger();
        } else {
            return new BigInteger(Long.toString(self.longValue()));
        }
    }
342262
private Object finalizeConversion(Object o)
  {
    // conversion can leave 'wrapped' list primitives
    if (ParquetGroupConverter.isWrappedListPrimitive(o)) {
      return converter.unwrapListPrimitive(o);
    } else if (o instanceof List) {
      List<Object> asList = ((List<Object>) o).stream().filter(Objects::nonNull).collect(Collectors.toList());
      if (asList.stream().allMatch(ParquetGroupConverter::isWrappedListPrimitive)) {
        return asList.stream().map(Group.class::cast).map(converter::unwrapListPrimitive).collect(Collectors.toList());
      }
    }
    return o;
  }
638409
def from_list(cls, l):
        """"""
        if len(l) == 3:
                x, y, z = map(float, l)
                return cls(x, y, z)
        elif len(l) == 2:
            x, y = map(float, l)
            return cls(x, y)
        else:
            raise AttributeError
1130163
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value:
        """"""
        def convert(val):
            if isinstance(val, list):
                res = ArrayValue([convert(x) for x in val])
            elif isinstance(val, dict):
                res = ObjectValue({x: convert(val[x]) for x in val})
            else:
                res = val
            return res
        return convert(rval)
168117
private Object convert(Object value, String type) {
        if (EnumRuleType.STRING.equals(type)) {
            if (!(value instanceof String)) {
                return String.valueOf(value);
            }
        } else if (EnumRuleType.DOUBLE.equals(type)) {
            if (!(value instanceof Double)) {
                if (value instanceof Number) {
                    return NumberUtils.convertNumberToTargetClass((Number) value, Double.class);
                } else {
                    return NumberUtils.parseNumber(value.toString(), Double.class);
                }
            }
        } else if (EnumRuleType.INTEGER.equals(type)) {
            if (!(value instanceof Integer)) {
                if (value instanceof Number) {
                    return NumberUtils.convertNumberToTargetClass((Number) value, Integer.class);
                } else {
                    return NumberUtils.parseNumber(value.toString(), Integer.class);
                }
            }
        }
        return value;
    }
1370925
public void convert(TypeDesc fromType, TypeDesc toType) {
        if (toType == TypeDesc.OBJECT) {
            if (fromType.isPrimitive()) {
                toType = fromType.toObjectType();
            }
            else {
                return;
            }
        }

        if (fromType == toType) {
            return;
        }

        TypeDesc fromPrimitiveType = fromType.toPrimitiveType();
        if (fromPrimitiveType == null) {
            throw invalidConversion(fromType, toType);
        }
        int fromTypeCode = fromPrimitiveType.getTypeCode();

        if (!fromType.isPrimitive()) {
            unbox(fromType, fromPrimitiveType);
        }

        TypeDesc toPrimitiveType = toType.toPrimitiveType();
        if (toPrimitiveType == null) {
            throw invalidConversion(fromType, toType);
        }
        int toTypeCode = toPrimitiveType.getTypeCode();

        int stackAdjust = 0;
        byte op;

        switch (fromTypeCode) {
        case TypeDesc.INT_CODE:
        case TypeDesc.BYTE_CODE:
        case TypeDesc.SHORT_CODE:
        case TypeDesc.CHAR_CODE:
        case TypeDesc.BOOLEAN_CODE:
            switch (toTypeCode) {
            case TypeDesc.BYTE_CODE:
                op = (fromTypeCode == TypeDesc.BYTE_CODE) ?
                    Opcode.NOP : Opcode.I2B;
                break;
            case TypeDesc.SHORT_CODE:
                op = (fromTypeCode == TypeDesc.SHORT_CODE) ?
                    Opcode.NOP : Opcode.I2S;
                break;
            case TypeDesc.CHAR_CODE:
                op = (fromTypeCode == TypeDesc.CHAR_CODE) ?
                    Opcode.NOP : Opcode.I2C;
                break;
            case TypeDesc.FLOAT_CODE:
                op = Opcode.I2F;
                break;
            case TypeDesc.LONG_CODE:
                stackAdjust = 1;
                op = Opcode.I2L;
                break;
            case TypeDesc.DOUBLE_CODE:
                stackAdjust = 1;
                op = Opcode.I2D;
                break;
            case TypeDesc.INT_CODE:
                op = Opcode.NOP;
                break;
            case TypeDesc.BOOLEAN_CODE:
                toBoolean(!toType.isPrimitive());
                return;
            default:
                throw invalidConversion(fromType, toType);
            }
            break;

        case TypeDesc.LONG_CODE:
            switch (toTypeCode) {
            case TypeDesc.INT_CODE:
                stackAdjust = -1;
                op = Opcode.L2I;
                break;
            case TypeDesc.FLOAT_CODE:
                stackAdjust = -1;
                op = Opcode.L2F;
                break;
            case TypeDesc.DOUBLE_CODE:
                op = Opcode.L2D;
                break;
            case TypeDesc.BYTE_CODE:
            case TypeDesc.CHAR_CODE:
            case TypeDesc.SHORT_CODE:
                addCode(-1, Opcode.L2I);
                convert(TypeDesc.INT, toPrimitiveType);
                // fall through
            case TypeDesc.LONG_CODE:
                op = Opcode.NOP;
                break;
            case TypeDesc.BOOLEAN_CODE:
                loadConstant(0L);
                math(Opcode.LCMP);
                toBoolean(!toType.isPrimitive());
                return;
            default:
                throw invalidConversion(fromType, toType);
            }
            break;

        case TypeDesc.FLOAT_CODE:
            switch (toTypeCode) {
            case TypeDesc.INT_CODE:
                op = Opcode.F2I;
                break;
            case TypeDesc.LONG_CODE:
                stackAdjust = 1;
                op = Opcode.F2L;
                break;
            case TypeDesc.DOUBLE_CODE:
                stackAdjust = 1;
                op = Opcode.F2D;
                break;
            case TypeDesc.BYTE_CODE:
            case TypeDesc.CHAR_CODE:
            case TypeDesc.SHORT_CODE:
                addCode(0, Opcode.F2I);
                convert(TypeDesc.INT, toPrimitiveType);
                // fall through
            case TypeDesc.FLOAT_CODE:
                op = Opcode.NOP;
                break;
            case TypeDesc.BOOLEAN_CODE:
                loadConstant(0.0f);
                math(Opcode.FCMPG);
                toBoolean(!toType.isPrimitive());
                return;
            default:
                throw invalidConversion(fromType, toType);
            }
            break;

        case TypeDesc.DOUBLE_CODE:
            switch (toTypeCode) {
            case TypeDesc.INT_CODE:
                stackAdjust = -1;
                op = Opcode.D2I;
                break;
            case TypeDesc.FLOAT_CODE:
                stackAdjust = -1;
                op = Opcode.D2F;
                break;
            case TypeDesc.LONG_CODE:
                op = Opcode.D2L;
                break;
            case TypeDesc.BYTE_CODE:
            case TypeDesc.CHAR_CODE:
            case TypeDesc.SHORT_CODE:
                addCode(-1, Opcode.D2I);
                convert(TypeDesc.INT, toPrimitiveType);
                // fall through
            case TypeDesc.DOUBLE_CODE:
                op = Opcode.NOP;
                break;
            case TypeDesc.BOOLEAN_CODE:
                loadConstant(0.0d);
                math(Opcode.DCMPG);
                toBoolean(!toType.isPrimitive());
                return;
            default:
                throw invalidConversion(fromType, toType);
            }
            break;

        default:
            throw invalidConversion(fromType, toType);
        }

        if (toType.isPrimitive()) {
            if (op != Opcode.NOP) {
                addCode(stackAdjust, op);
            }
        }
        else {
            if (op == Opcode.NOP) {
                prebox(toPrimitiveType, toType);
            }
            // Slight optimization here. Perform prebox on single word value,
            // depending on what conversion is being applied.
            else if (!fromPrimitiveType.isDoubleWord() &&
                     toPrimitiveType.isDoubleWord()) {
                prebox(fromPrimitiveType, toType);
                addCode(stackAdjust, op);
            }
            else {
                addCode(stackAdjust, op);
                prebox(toPrimitiveType, toType);
            }
            box(toPrimitiveType, toType);
        }
    }