def get_node(self, node_id, model_id): weight = self.r.get(self.node_weight % (node_id, model_id)) content = self.__get_content(node_id) r_node = node(content, weight, model_id, node_id) return r_node
for r_neigh_id in r_neighs_ids: self.r.hincrby( self.node_rel % (node_id_right, id_left), r_neigh_id, int(r_neighs_ids[r_neigh_id]) ) #adding at model self.r.sadd(id_left, node_id_right) self.r.delete( self.node_rel % (node_id_right, id_right), self.node_weight % (node_id_right, id_right)) self.r.delete(id_right) return id_left if __name__ == '__main__': import time t_start = time.time() mh = model_handler(truncate=True) model_id = 'test' content = [u'привет', u'пока',u'уважь'] node_id1 = mh.add_node_or_increment(node(content, 10, model_id)) node = mh.get_node(node_id1, model_id) print type(node.content) print node.content t_stop = time.time() print t_stop - t_start