Parameters
		----------
		term_to_index_dict: term -> idx dictionary

		Returns
		-------
		IndexStore
175463
def build(term_to_index_dict):
		'''
		
		'''
		idxstore = IndexStore()
		idxstore._val2i = term_to_index_dict
		idxstore._next_i = len(term_to_index_dict)
		idxstore._i2val = [None for _ in range(idxstore._next_i)]
		for term, idx in idxstore._val2i.items():
			idxstore._i2val[idx] = term
		return idxstore
976927
def get_or_create_index(self, paths=None, name=None, refresh=False):
        
        if not paths:
            paths = sys.path
        if not name:
            name = 'default'
        self._name = name

        idx_dir = get_cache_dir()
        idx_file = os.path.join(idx_dir, name + '.json')

        if os.path.exists(idx_file) and not refresh:
            with open(idx_file) as fd:
                self.deserialize(fd)
        else:
            self.build_index(paths)
            with open(idx_file, 'w') as fd:
                self.serialize(fd)

        return self
571988
def convert_index_to_keys(d, item):
    # use a separate function rather than a method inside the class IndexDict
    '''
    
    '''

    keys = force_list(d.keys())
    # use KeyError for compatibility of normal use

    # Warning: int item will be interpreted as the index rather than key!!
    if isinstance(item, int):
        item = _int_to_key(keys, item)
        single = True

    elif isinstance(item, (tuple, list)):
        item2 = []
        for i in item:
            i = _int_to_key(keys, i)
            item2.append(i)
        item = item2
        single = False

    elif isinstance(item, slice):
        start, stop, step = item.start, item.stop, item.step
        # None is not interpreted as a key
        if not isinstance(start, (NoneType, int)):
            try:
                start = keys.index(start)
            except ValueError:
                raise KeyError('%s is not in the list of keys' % (start,))
        if not isinstance(stop, (NoneType, int)):
            try:
                stop = keys.index(stop)
            except ValueError:
                raise KeyError('%s is not in the list of keys' % (stop,))
        item = keys[start:stop:step]
        single = False

    else:  # other types, treated as a single key
        IndexDict_check_key_type(item)
        single = True

    return item, single
241846
def get_term(self,term_id):
        
        if term_id in self.idx:
            return Cterm(self.idx[term_id],self.type)
        else:
            return None
668036
def get_index_node(self, idx):
        ''''''
        idx = self.node_index.index(idx)
        return self.nodes[idx]
537403
def _index2word(self):
        
        # TODO(kelvinguu): it would be nice to just use `dict.viewkeys`, but unfortunately those are not indexable

        compute_index2word = lambda: self.keys()  # this works because self is an OrderedDict

        # create if it doesn't exist
        try:
            self._index2word_cache
        except AttributeError:
            self._index2word_cache = compute_index2word()

        # update if it is out of date
        if len(self._index2word_cache) != len(self):
            self._index2word_cache = compute_index2word()

        return self._index2word_cache
134853
def to_dict(self):
        
        if self.txid is None and self.output is None:
            return None
        else:
            return {
                'transaction_id': self.txid,
                'output_index': self.output,
            }
239940
def todict(self):
        
        return {'index': self.index,
                'seed': hb_encode(self.seed),
                'n': self.n,
                'root': hb_encode(self.root),
                'hmac': hb_encode(self.hmac),
                'timestamp': self.timestamp}
482131
def build(values):
		'''
		
		'''
		idxstore = IndexStore()
		idxstore._i2val = list(values)
		idxstore._val2i = {term:i for i,term in enumerate(values)}
		idxstore._next_i = len(values)
		return idxstore
1121241
def index_to_widget(self, idx):
        """"""
        nchild = self.mdi_w.get_nth_page(idx)
        return self._native_to_child(nchild)
1375005
def to_index(self):
        """"""
        # n.b. creating a new pandas.Index from an old pandas.Index is
        # basically free as pandas.Index objects are immutable
        assert self.ndim == 1
        index = self._data.array
        if isinstance(index, pd.MultiIndex):
            # set default names for multi-index unnamed levels so that
            # we can safely rename dimension / coordinate later
            valid_level_names = [name or '{}_level_{}'.format(self.dims[0], i)
                                 for i, name in enumerate(index.names)]
            index = index.set_names(valid_level_names)
        else:
            index = index.set_names(self.name)
        return index
85414
def multi_index_to_frame(index):
    
    return pandas.DataFrame(index.tolist(), index=index, columns=index.names)
383824
def get_index_mapping(index):
    
    # app_path = apps.get_app_config('elasticsearch_django').path
    mappings_dir = get_setting("mappings_dir")
    filename = "%s.json" % index
    path = os.path.join(mappings_dir, filename)
    with open(path, "r") as f:
        return json.load(f)
1089431
def get_indexes(self):
        
        ret = {}
        for index in self.iter_query_indexes():
            ret[index.name] = index
        return ret
1369594
def to_dict(self):
        
        d = {}
        for word, idx in self.vocab.iteritems():
            d[word] = self.array[idx].tolist()
        return d
1327431
def get_index(self, index, startkey, endkey=None, return_terms=None,
                  max_results=None, continuation=None, timeout=None,
                  term_regex=None):
        
        return self._client.get_index(self, index, startkey, endkey,
                                      return_terms=return_terms,
                                      max_results=max_results,
                                      continuation=continuation,
                                      timeout=timeout, term_regex=term_regex)
635250
def as_a_dict(self):
        
        index_dict = {
            'ddoc': self._ddoc_id,
            'name': self._name,
            'type': self._type,
            'def': self._def
        }

        if self._partitioned:
            index_dict['partitioned'] = True

        return index_dict