Return dictionary representation of type.

    Can be used to initialize primordium.type.primitives.Type
327763
def get_type_data(name):
    
    name = name.upper()
    if name in ISO_CURRENCY_TYPES:
        article = 'the '
        type_name = ISO_CURRENCY_TYPES[name]
    elif name in ISO_CURRENCY_ELEMENT_TYPES:
        article = ''
        type_name = ISO_CURRENCY_ELEMENT_TYPES[name]
    else:
        raise NotFound('Currency Type: ' + name)

    return {
        'authority': 'ISO',
        'namespace': '4217',
        'identifier': name,
        'domain': 'ISO Currency Types',
        'display_name': type_name + ' Currency Type',
        'display_label': type_name,
        'description': ('The ISO currency type for ' + article +
                        type_name + '.')
    }
809704
def type_string(self):
        """"""
        if self.is_tuple:
            subtypes = [item.type_string for item in self.children]
            return '{}({})'.format(
                '' if self.val_guaranteed else '*',
                ', '.join(subtypes))
        elif self.is_list:
            return '{}[{}]'.format(
                '' if self.val_guaranteed else '*',
                self.children[0].type_string)
        else:
            return '{}{}'.format(
                '' if self.val_guaranteed else '*',
                self.type_.__name__)
457181
def to_dict(self):
        

        input_dict = super(Add, self)._save_to_input_dict()
        input_dict["class"] = str("GPy.kern.Add")
        return input_dict
1211939
def _ctype_dict(param_dict):
    
    assert(isinstance(param_dict, dict)), \
        "unexpected type for param_dict: " + str(type(param_dict))
    c_keys = c_array(ctypes.c_char_p, [c_str(k) for k in param_dict.keys()])
    c_vals = c_array(ctypes.c_char_p, [c_str(str(v)) for v in param_dict.values()])
    return (c_keys, c_vals)
65874
def get_primitive_name(schema):
    
    try:
        return {
            const.COMPILED_TYPE.LITERAL: six.text_type,
            const.COMPILED_TYPE.TYPE: get_type_name,
            const.COMPILED_TYPE.ENUM: get_type_name,
            const.COMPILED_TYPE.CALLABLE: get_callable_name,
            const.COMPILED_TYPE.ITERABLE: lambda x: _(u'{type}[{content}]').format(type=get_type_name(list), content=_(u'...') if x else _(u'-')),
            const.COMPILED_TYPE.MAPPING:  lambda x: _(u'{type}[{content}]').format(type=get_type_name(dict), content=_(u'...') if x else _(u'-')),
        }[primitive_type(schema)](schema)
    except KeyError:
        return six.text_type(repr(schema))
183557
def to_dict(self, remove_nones=False):
        

        if remove_nones:
            return super().to_dict(remove_nones=True)

        return {
            'id': self.id,
            'name': self.name,
            'type': self.type
        }
868061
def to_dict(self):
        
        return {
            'type': self.__class__.__name__,
            'element_id': self.element_id,
            'style_class': self.style_class,
            'icon': self.icon,
            'attributes': self.attributes
        }
414624
def _dictionary(self):
        # type: () -> Dict[str, Any]
        
        # NOTE: Dictionaries are not populated if not loaded. So, conditionals
        #       are not needed here.
        retval = {}

        for variant in self._override_order:
            retval.update(self._config[variant])

        return retval
49613
def as_base_types(self):
    """"""
    if not self._cached:
      # Create the single cache file the first time this is called.
      self._cached = {
          'name': self.name,
          'outcome': self.outcome.name,
      }
      if self.validators:
        self._cached['validators'] = data.convert_to_base_types(
            tuple(str(v) for v in self.validators))
      if self.dimensions:
        self._cached['dimensions'] = data.convert_to_base_types(self.dimensions)
      if self.units:
        self._cached['units'] = data.convert_to_base_types(self.units)
      if self.docstring:
        self._cached['docstring'] = self.docstring
    if self.measured_value.is_value_set:
      self._cached['measured_value'] = self.measured_value.basetype_value()
    return self._cached
957778
def to_dict(self, dict_cls=FrozenOrderedDict):
        # type: (Type[dict]) -> Dict[str, Any]
        
        pairs = tuple((k, serialize_object(getattr(self, k), dict_cls))
                      for k in self.call_types)
        if self.typeid:
            d = dict_cls((("typeid", self.typeid),) + pairs)
        else:
            d = dict_cls(pairs)
        return d
877910
def to_dict(self):
        # type: () -> OrderedDict
        

        d = OrderedDict()
        if self.typeid:
            d["typeid"] = self.typeid

        for k in self.call_types:
            # check_camel_case(k)
            d[k] = serialize_object(getattr(self, k))

        return d
884712
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'type') and self.type is not None:
            _dict['type'] = self.type
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        return _dict
511866
def _dict_to_obj(self, d):
    """"""
    if JsonEncoder.TYPE_ID not in d:
      return d

    type_name = d.pop(JsonEncoder.TYPE_ID)
    if type_name in _TYPE_NAME_TO_DECODER:
      decoder = _TYPE_NAME_TO_DECODER[type_name]
      return decoder(d)
    else:
      raise TypeError("Invalid type %s.", type_name)
1141729
def struct_types(self):
        
        it = ffi.lib.LLVMPY_ModuleTypesIter(self)
        return _TypesIterator(it, dict(module=self))
1360092
def types_(self, col: str) -> pd.DataFrame:
        
        cols = self.df.columns.values
        all_types = {}
        for col in cols:
            local_types = []
            for i, val in self.df[col].iteritems():
                #print(i, val, type(val))
                t = type(val).__name__
                if t not in local_types:
                    local_types.append(t)
            all_types[col] = (local_types, i)
        df = pd.DataFrame(all_types, index=["type", "num"])
        return df
593605
def type(self):
        
        kv_type = ctypes.c_char_p()
        check_call(_LIB.MXKVStoreGetType(self.handle, ctypes.byref(kv_type)))
        return py_str(kv_type.value)
390869
def to_primitive(self, context=None):
        
        return {
            'name': self.name,
            'items': [x.to_primitive(context) for x in self.iterconstants()]
        }