Integer types
        :param elem:
        :param elem_type:
        :param params:
        :return:
342510
async def uint(self, elem, elem_type, params=None):
        
        one_b_type = x.is_type(elem_type, (x.Int8, x.UInt8))
        if self.writing:
            return (await x.dump_uint(self.iobj, elem, 1)) if one_b_type else (await dump_uvarint(self.iobj, elem))
        else:
            return (await x.load_uint(self.iobj, 1)) if one_b_type else (await load_uvarint(self.iobj))
554787
def guess_param_types(**kwargs):
    
    params = {}
    for k, v in kwargs.items():
        kws = dict(default=v, constant=True)
        if isinstance(v, Parameter):
            params[k] = v
        elif isinstance(v, dt_types):
            params[k] = Date(**kws)
        elif isinstance(v, bool):
            params[k] = Boolean(**kws)
        elif isinstance(v, int):
            params[k] = Integer(**kws)
        elif isinstance(v, float):
            params[k] = Number(**kws)
        elif isinstance(v, str):
            params[k] = String(**kws)
        elif isinstance(v, dict):
            params[k] = Dict(**kws)
        elif isinstance(v, tuple):
            if all(_is_number(el) for el in v):
                params[k] = NumericTuple(**kws)
            elif all(isinstance(el. dt_types) for el in v) and len(v)==2:
                params[k] = DateRange(**kws)
            else:
                params[k] = Tuple(**kws)
        elif isinstance(v, list):
            params[k] = List(**kws)
        elif isinstance(v, np.ndarray):
            params[k] = Array(**kws)
        else:
            from pandas import DataFrame as pdDFrame
            from pandas import Series as pdSeries

            if isinstance(v, pdDFrame):
                params[k] = DataFrame(**kws)
            elif isinstance(v, pdSeries):
                params[k] = Series(**kws)
            else:
                params[k] = Parameter(**kws)

    return params
778849
async def load_field(obj, elem_type, params=None, elem=None):
    
    if issubclass(elem_type, x.UVarintType) or issubclass(elem_type, x.IntType) or isinstance(obj, (int, bool)):
        return set_elem(elem, obj)

    elif issubclass(elem_type, x.BlobType):
        fvalue = await load_blob(obj, elem_type)
        return set_elem(elem, fvalue)

    elif issubclass(elem_type, x.UnicodeType) or isinstance(elem, str):
        return set_elem(elem, obj)

    elif issubclass(elem_type, x.VariantType):
        fvalue = await load_variant(obj, elem=get_elem(elem), elem_type=elem_type, params=params)
        return set_elem(elem, fvalue)

    elif issubclass(elem_type, x.ContainerType):  # container ~ simple list
        fvalue = await load_container(obj, elem_type, params=params, container=get_elem(elem))
        return set_elem(elem, fvalue)

    elif issubclass(elem_type, x.MessageType):
        fvalue = await load_message(obj, msg_type=elem_type, msg=get_elem(elem))
        return set_elem(elem, fvalue)

    else:
        raise TypeError
471855
def literal_array(cls, elems):
        
        tys = [el.type for el in elems]
        if len(tys) == 0:
            raise ValueError("need at least one element")
        ty = tys[0]
        for other in tys:
            if ty != other:
                raise TypeError("all elements must have the same type")
        return cls(types.ArrayType(ty, len(elems)), elems)
1044532
def is_elementary_type(elem_type):
        
        if not oh.is_type(elem_type, bt.XmrType):
            return False
        if oh.is_type(elem_type, (bt.UVarintType, bt.IntType, mt.UnicodeType)):
            return True
        return False
594929
def DEFINE_integer(self, name, default, help, constant=False):
    """"""
    self.AddOption(
        type_info.Integer(name=name, default=default, description=help),
        constant=constant)
860450
async def dump_tuple(self, elem, elem_type, params=None):
        
        if len(elem) != len(elem_type.f_specs()):
            raise ValueError('Fixed size tuple has not defined size: %s' % len(elem_type.f_specs()))

        elem_fields = params[0] if params else None
        if elem_fields is None:
            elem_fields = elem_type.f_specs()
        for idx, elem in enumerate(elem):
            try:
                self.tracker.push_index(idx)
                await self._dump_field(elem, elem_fields[idx], params[1:] if params else None)
                self.tracker.pop()

            except Exception as e:
                raise helpers.ArchiveException(e, tracker=self.tracker) from e
39343
def check_int(**params):
    
    for p in params:
        if not isinstance(params[p], numbers.Integral):
            raise ValueError(
                "Expected {} integer, got {}".format(p, params[p]))
1278486
def format_parameter(element):
    
    if isinstance(element, integer_types) or isinstance(element, np.int_):
        return repr(element)
    elif isinstance(element, float):
        return _check_for_pi(element)
    elif isinstance(element, complex):
        out = ''
        r = element.real
        i = element.imag
        if i == 0:
            return repr(r)

        if r != 0:
            out += repr(r)

        if i == 1:
            assert np.isclose(r, 0, atol=1e-14)
            out = 'i'
        elif i == -1:
            assert np.isclose(r, 0, atol=1e-14)
            out = '-i'
        elif i < 0:
            out += repr(i) + 'i'
        elif r != 0:
            out += '+' + repr(i) + 'i'
        else:
            out += repr(i) + 'i'

        return out
    elif isinstance(element, MemoryReference):
        return str(element)
    elif isinstance(element, Expression):
        return _expression_to_string(element)
    elif isinstance(element, MemoryReference):
        return element.out()
    assert False, "Invalid parameter: %r" % element
463789
def parityOf(int_type):
    
    parity = 0
    while (int_type):
        parity = ~parity
        int_type = int_type & (int_type - 1)
    return(parity)
1314196
def _get_types(self):
		
		types = []
		num_values = []
		for hp in self.configspace.get_hyperparameters():
			#print(hp)
			if isinstance(hp, CS.CategoricalHyperparameter):
				types.append('U')
				num_values.append(len(hp.choices))
			elif isinstance(hp, CS.UniformIntegerHyperparameter):
				types.append('I')
				num_values.append((hp.upper - hp.lower + 1))
			elif isinstance(hp, CS.UniformFloatHyperparameter):
				types.append('C')
				num_values.append(np.inf)
			elif isinstance(hp, CS.OrdinalHyperparameter):
				types.append('O')
				num_values.append(len(hp.sequence))
			else:
				raise ValueError('Unsupported Parametertype %s'%type(hp))
		return(types, num_values)
903906
async def unicode_type(self, elem):
        
        if self.writing:
            await dump_uvarint(self.iobj, len(elem))
            await self.iobj.awrite(bytes(elem, 'utf8'))

        else:
            ivalue = await load_uvarint(self.iobj)
            if ivalue == 0:
                return ''

            fvalue = bytearray(ivalue)
            await self.iobj.areadinto(fvalue)
            return str(fvalue, 'utf8')
724560
def new_param(name, type, value, start = None, scale = None, unit = None, dataunit = None, comment = None):
	
	elem = Param()
	elem.Name = name
	elem.Type = type
	elem.pcdata = value
	# FIXME:  I have no idea how most of the attributes should be
	# encoded, I don't even know what they're supposed to be.
	if dataunit is not None:
		elem.DataUnit = dataunit
	if scale is not None:
		elem.Scale = scale
	if start is not None:
		elem.Start = start
	if unit is not None:
		elem.Unit = unit
	if comment is not None:
		elem.appendChild(ligolw.Comment())
		elem.childNodes[-1].pcdata = comment
	return elem
92002
def __parameter_enum(self, param):
    
    if isinstance(param, messages.EnumField):
      return [enum_entry[0] for enum_entry in sorted(
          param.type.to_dict().items(), key=lambda v: v[1])]
806672
def resourcetypes(rid, model):
    '''
    
    '''
    types = []
    for o, r, t, a in model.match(rid, VTYPE_REL):
        types.append(t)
    return types
498597
def p_types(self, p):
        ''''''
        if len(p) == 2:
            p[0] = tuple((t,) for t in p[1])
        else:
            p[0] = tuple((t,) + ts for t in p[1] for ts in p[3])
1340320
def gen_elem_array(size, elem_type=None):
    
    if elem_type is None or not callable(elem_type):
        return [elem_type] * size
    if is_type(elem_type, ContainerType):

        def elem_type():
            return []

    res = []
    for _ in range(size):
        res.append(elem_type())
    return res