get the inner store as dictionary
510560
def getStore(self) :
        """"""
        res = {}
        res.update(self.store)
        for k, v in self.subStores.items() :
            res[k] = v.getStore()
        
        return res
528891
def as_dict(self, depth=0):
        
        result_dict = {}
        for column in self.__table__.columns.keys():
            result_dict[column] = getattr(self, column, None)
            if isinstance(result_dict[column], Decimal):
                result_dict[column] = str(result_dict[column])
        result_dict['links'] = self.links()
        for foreign_key in self.__table__.foreign_keys:
            column_name = foreign_key.column.name
            column_value = getattr(self, column_name, None)
            if column_value:
                table = foreign_key.column.table.name
                with app.app_context():
                    endpoint = current_app.class_references[table]
                    session = db.session()
                    resource = session.query(endpoint).get(column_value)
                if depth > 0:
                    result_dict.update({
                        'rel': endpoint.__name__,
                        endpoint.__name__.lower(): resource.as_dict(depth - 1)
                        })
                else:
                    result_dict[
                        endpoint.__name__.lower() + '_url'] = '/{}/{}'.format(
                        endpoint.__name__, column_value)

        result_dict['self'] = self.resource_uri()
        return result_dict
1163677
def get_inner_keys(dictionary):
    

    keys = []

    for key in dictionary.keys():
        inner_keys = dictionary[key].keys()
        keys += [
            key + " " + inner_key  # concatenate
            for inner_key in inner_keys
        ]

    return keys
125240
def to_dict(self):
        
        return {key: val.to_dict() if isinstance(val, NestedDict) else val
                for key, val in self.items()}
132914
def _as_dict(self):
        
        values = self._dynamic_columns or {}
        for name, col in self._columns.items():
            values[name] = col.to_database(getattr(self, name, None))
        return values
637068
def _to_dict(self):
        
        if self.all_:
            return {"all": True}

        return {
            "keys": self.keys,
            "ranges": [keyrange._to_dict() for keyrange in self.ranges],
        }
917463
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'limit') and self.limit is not None:
            _dict['limit'] = self.limit
        if hasattr(self, 'keywords') and self.keywords is not None:
            _dict['keywords'] = self.keywords
        if hasattr(self, 'entities') and self.entities is not None:
            _dict['entities'] = self.entities
        return _dict
117868
def _build_dictionary(self, results):
        
        foreign = self._foreign_key

        dictionary = {}

        for result in results:
            key = getattr(result.pivot, foreign)
            if key not in dictionary:
                dictionary[key] = []

            dictionary[key].append(result)

        return dictionary
790014
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'step') and self.step is not None:
            _dict['step'] = self.step
        if hasattr(self, 'snapshot') and self.snapshot is not None:
            _dict['snapshot'] = self.snapshot
        return _dict
885148
def copy(self):
        """"""
        new_dict = IDict(std=self._std)
        new_dict.update(self.store)
        return new_dict
2121
def get_as_dict(x):
    """"""
    if isinstance(x, dict):
        return x
    else:
        try:
            return x._asdict()
        except AttributeError:
            return x.__dict__
494020
def dictionary(self):
        
        output = {}
        for i in range(self.topLevelItemCount() - 1):
            item = self.topLevelItem(i)
            output[nativestring(item.text(1))] = nativestring(item.text(2))
        return output
1079099
def dict(self):
        
        return_obj = {}
        for attr in dir(self):
            if not attr.startswith('__') and attr not in self.__reserved:
                if isinstance(getattr(self, attr), list):
                    return_val = []
                    for item in getattr(self, attr):
                        if isinstance(item, DictClass):
                            return_val.append(dict(item))
                        else:
                            return_val.append(item)
                elif isinstance(getattr(self, attr), dict):
                    return_val = {}
                    for key, item in getattr(self, attr).items():
                        if isinstance(item, DictClass):
                            return_val[key] = item.dict()
                        else:
                            return_val[key] = item
                elif isinstance(getattr(self, attr), DictClass):
                    return_val = getattr(self, attr).dict()
                else:
                    return_val = getattr(self, attr)
                return_obj[attr] = return_val
        return return_obj
613920
def _to_dict_of_blocks(self, copy=True):
        
        return {k: self._constructor(v).__finalize__(self)
                for k, v, in self._data.to_dict(copy=copy).items()}
308807
def nameddict(name, props):
    
    class NamedDict(object):
        def __init__(self, *args, **kwargs):
            self.__store = {}.fromkeys(props)
            if args:
                for i, k in enumerate(props[:len(args)]):
                    self[k] = args[i]
            for k, v in kwargs.items():
                self[k] = v

        def __getattr__(self, key):
            # print '+', key
            if key.startswith('_NamedDict__'):
                return self.__dict__[key]
            else:
                return self.__store[key]

        def __setattr__(self, key, value):
            # print '-', key
            if key.startswith('_NamedDict__'):
                object.__setattr__(self, key, value)
            else:
                self.__setitem__(key, value)
                # self.__store[key] = value

        def __getitem__(self, key):
            return self.__store[key]

        def __setitem__(self, key, value):
            if key not in props:
                raise AttributeError("NamedDict(%s) has no attribute %s, avaliables are %s" % (
                    name, key, props))
            self.__store[key] = value

        def __dict__(self):
            return self.__store

        def __str__(self):
            return 'NamedDict(%s: %s)' % (name, str(self.__store))

    return NamedDict
570458
def data_to_dict(self, sysbase=False):
        
        assert isinstance(sysbase, bool)

        ret = {}

        for key in self.data_keys:
            if (not sysbase) and (key in self._store):
                val = self._store[key]
            else:
                val = self.__dict__[key]

            ret[key] = val

        return ret
1338053
def to_dict(self, in_dict=None):
        
        in_dict = in_dict if in_dict else self
        out_dict = dict()
        for k, v in in_dict.items():
            if isinstance(v, Namespace):
                v = v.to_dict()
            out_dict[k] = v
        return out_dict