Rebuilds the current item in day mode.
194665
def rebuildDay( self ):
        
        scene = self.scene()
        if ( not scene ):
            return
        
        # calculate the base information
        start_date = self.dateStart()
        end_date   = self.dateEnd()
        min_date   = scene.minimumDate()
        max_date   = scene.maximumDate()
        
        # make sure our item is visible
        if ( not (min_date <= end_date and start_date <= max_date)):
            self.hide()
            self.setPath(QPainterPath())
            return
        
        # make sure we have valid range information
        if ( start_date < min_date ):
            start_date    = min_date
            start_inrange = False
        else:
            start_inrange = True
        
        if ( max_date < end_date ):
            end_date     = max_date
            end_inrange  = False
        else:
            end_inrange  = True
        
        # rebuild the path
        path = QPainterPath()
        self.setPos(0, 0)
        
        pad         = 2
        offset      = 18
        height      = 16
        
        # rebuild a timed item
        if ( not self.isAllDay() ):
            start_dtime = QDateTime(self.dateStart(), self.timeStart())
            end_dtime   = QDateTime(self.dateStart(), 
                                    self.timeEnd().addSecs(-30*60))
            
            start_rect  = scene.dateTimeRect(start_dtime)
            end_rect    = scene.dateTimeRect(end_dtime)
            
            left   = start_rect.left() + pad
            top    = start_rect.top() + pad
            right  = start_rect.right() - pad
            bottom = end_rect.bottom() - pad
            
            path.moveTo(left, top)
            path.lineTo(right, top)
            path.lineTo(right, bottom)
            path.lineTo(left, bottom)
            path.lineTo(left, top)
            
            data = (left + 6, 
                    top + 6, 
                    right - left - 12, 
                    bottom - top - 12,
                    Qt.AlignTop | Qt.AlignLeft,
                    '%s - %s\n(%s)' % (self.timeStart().toString('h:mmap')[:-1],
                                       self.timeEnd().toString('h:mmap'),
                                       self.title()))
            
            self._textData.append(data)
        
        self.setPath(path)
        self.show()
1226631
def rebuild( self ):
        
        rect    = self.sceneRect()
        x       = rect.left()
        y       = rect.top()
        w       = rect.width()
        h       = rect.height()
        
        # calculate background gridlines
        cx      = x + (w / 2)
        cy      = y + (h / 2)
        
        self._centerLines = [QLine(cx, rect.top(), cx, rect.bottom()),
                             QLine(rect.left(), cy, rect.right(), cy) ]
        
        # create the horizontal grid lines
        delta           = self.cellHeight()
        minor_lines     = []
        major_lines     = []
        count           = 1
        while delta < (h / 2):
            pos_line = QLine(x, cy + delta, x + w, cy + delta)
            neg_line = QLine(x, cy - delta, x + w, cy - delta)
            
            # every 10th line will be a major line
            if count == 10:
                major_lines.append(pos_line)
                major_lines.append(neg_line)
                count = 1
            else:
                minor_lines.append(pos_line)
                minor_lines.append(neg_line)
            
            # update the current y location
            delta += self.cellHeight()
            count += 1
        
        # create the vertical grid lines
        delta = self.cellWidth()
        count = 1
        while delta < (w / 2):
            pos_line = QLine(cx + delta, y, cx + delta, y + h)
            neg_line = QLine(cx - delta, y, cx - delta, y + h)
            
            # every 10th line will be a major line
            if count == 10:
                major_lines.append(pos_line)
                major_lines.append(neg_line)
                count = 1
            else:
                minor_lines.append(pos_line)
                minor_lines.append(neg_line)
            
            # update the current y location
            delta += self.cellWidth()
            count += 1
        
        # set the line cache
        self._majorLines = major_lines
        self._minorLines = minor_lines
        
        # unmark the scene as being dirty
        self.setDirty(False)
152911
def rebuildtable(cls):
        """"""
        cls._closure_model.objects.all().delete()
        cls._closure_model.objects.bulk_create([cls._closure_model(
            parent_id=x['pk'],
            child_id=x['pk'],
            depth=0
        ) for x in cls.objects.values("pk")])
        for node in cls.objects.all():
            node._closure_createlink()
256867
def redo(self, channel, image):
        """"""
        self._image = None  # Skip cache checking in set_header()
        info = channel.extdata._header_info

        self.set_header(info, image)
1318514
def rebuild(self):
        
        # create the path
        path = self.rebuildPath()
        self._polygons = self.rebuildPolygons(path)

        if self._textItem:
            point = path.pointAtPercent(0.5)
            metrics = QFontMetrics(self._textItem.font())

            point.setY(point.y() - metrics.height() / 2.0)

            self._textItem.setPos(point)

        # create the path for the item
        for poly in self._polygons:
            path.addPolygon(poly)

        # unmark as dirty
        self.setDirty(False)

        return path
509946
def set_item(self,item):
        ""
        self.item = self.x.process_one(item)
        yield None
        self.item = None
984306
def rebuild_tree(self, request):
        '''
        
        '''
        self.model.objects.rebuild()
        self.message_user(request, _('Menu Tree Rebuilt.'))
        return self.clean_cache(request)
353669
def rebuildDays( self ):
        
        time = QTime(0, 0, 0)
        hour = True
        
        x = 6
        y = 6 + 24
        
        w = self.width() - 12 - 25
        
        dh         = 48
        indent     = 58
        text_data  = []
        
        vlines      = []
        hlines      = [QLine(x, y, w, y)]
        time_grids  = []
        
        for i in range(48):
            if ( hour ):
                hlines.append(QLine(x, y, w, y))
                text_data.append((x,
                                  y + 6, 
                                  indent - 6, 
                                  dh, 
                                  Qt.AlignRight | Qt.AlignTop,
                                  time.toString('hap')))
            else:
                hlines.append(QLine(x + indent, y, w, y))
            
            time_grids.append((time, y, dh / 2))
            
            # move onto the next line
            hour = not hour
            time = time.addSecs(30 * 60)
            y += dh / 2
        
        hlines.append(QLine(x, y, w, y))
        
        h = y
        y = 6 + 24
        
        # load the grid
        vlines.append(QLine(x, y, x, h))
        vlines.append(QLine(x + indent, y, x + indent, h))
        vlines.append(QLine(w, y, w, h))
        
        today     = QDate.currentDate()
        curr_date = self.currentDate()
        
        # load the days
        if ( self.currentMode() == XCalendarScene.Mode.Week ):
            date = self.currentDate()
            day_of_week = date.dayOfWeek()
            if ( day_of_week == 7 ):
                day_of_week = 0
            
            min_date = date.addDays(-day_of_week)
            max_date = date.addDays(6-day_of_week)
            
            self._minimumDate = min_date
            self._maximumDate = max_date
            
            dw    = (w - (x + indent)) / 7.0
            vx    = x + indent
            date  = min_date
            
            for i in range(7):
                vlines.append(QLine(vx, y, vx, h))
                
                text_data.append((vx + 6,
                                  6,
                                  dw,
                                  24,
                                  Qt.AlignCenter,
                                  date.toString('ddd MM/dd')))
                
                self._dateGrid[date.toJulianDay()] = ((0, i),
                                                      QRectF(vx, y, dw, h - y))
                
                # create the date grid for date time options
                for r, data in enumerate(time_grids):
                    time, ty, th = data
                    dtime = QDateTime(date, time)
                    key = dtime.toTime_t()
                    self._dateTimeGrid[key] = ((r, i), QRectF(vx, ty, dw, th))
                
                if ( date == curr_date ):
                    self._buildData['curr_date'] = QRectF(vx, y, dw, h - 29)
                elif ( date == today ):
                    self._buildData['today'] = QRectF(vx, y, dw, h - 29)
                
                date = date.addDays(1)
                vx += dw
        
        # load a single day
        else:
            date = self.currentDate()
            
            self._maximumDate = date
            self._minimumDate = date
            
            text_data.append((x + indent,
                              6,
                              w,
                              24,
                              Qt.AlignCenter,
                              date.toString('ddd MM/dd')))
            
            self._dateGrid[date.toJulianDay()] = ((0, 0), 
                                                  QRectF(x, y, w - x, h - y))
            
            # create the date grid for date time options
            for r, data in enumerate(time_grids):
                time, ty, th = data
                dtime = QDateTime(date, time)
                key = dtime.toTime_t()
                rect = QRectF(x + indent, ty, w - (x + indent), th)
                self._dateTimeGrid[key] = ((r, 0), rect)
        
        self._buildData['grid'] = hlines + vlines
        self._buildData['regular_text'] = text_data
        
        rect = self.sceneRect()
        rect.setHeight(h + 6)
        
        super(XCalendarScene, self).setSceneRect(rect)
1202251
def rebuildMonth( self ):
        
        scene = self.scene()
        if ( not scene ):
            return
        
        start_date  = self.dateStart()
        end_date    = self.dateEnd()
        min_date    = scene.minimumDate()
        max_date    = scene.maximumDate()
        
        # make sure our item is visible
        if ( not (min_date <= end_date and start_date <= max_date)):
            self.hide()
            self.setPath(QPainterPath())
            return
        
        # make sure we have valid range information
        if ( start_date < min_date ):
            start_date    = min_date
            start_inrange = False
        else:
            start_inrange = True
        
        if ( max_date < end_date ):
            end_date     = max_date
            end_inrange  = False
        else:
            end_inrange  = True
        
        start_rect = scene.dateRect(start_date)
        end_rect   = scene.dateRect(end_date)
        
        if ( not (start_rect.isValid() and end_rect.isValid()) ):
            self.hide()
            return
        
        # rebuild an all day path
        path = QPainterPath()
        self.setPos(0, 0)
        
        pad         = 2
        offset      = 18
        height      = 16
        
        min_left    = 10
        max_right   = scene.width() - 16
        delta_h     = start_rect.height()
        
        # draw the all day event
        if ( self.isAllDay() ):
            top   = start_rect.top()
            left  = start_rect.left() + 3
            first = start_inrange
            
            while ( top <= end_rect.top() ):
                sub_path  = QPainterPath()
                
                # calculate the end position
                if ( end_rect.top() - 2 <= top and end_inrange ):
                    at_end = True
                    right = end_rect.right() - pad
                else:
                    at_end = False
                    right = max_right
                
                if ( first ):
                    sub_path.moveTo(left, top + offset)
                    text_left = left + 4
                else:
                    sub_path.moveTo(left + height / 2, top + offset)
                    text_left = left + height / 2 + 2
                
                if ( at_end ):
                    sub_path.lineTo(right, top + offset)
                    sub_path.lineTo(right, top + offset + height)
                else:
                    sub_path.lineTo(right - height / 2, top + offset)
                    sub_path.lineTo(right, top + offset + height / 2)
                    sub_path.lineTo(right - height / 2, top + offset + height)
                
                if ( first ):
                    sub_path.lineTo(left, top + offset + height)
                    sub_path.lineTo(left, top + offset)
                else:
                    sub_path.lineTo(left + height / 2, top + offset + height)
                    sub_path.lineTo(left, top + offset + height / 2)
                    sub_path.lineTo(left + height / 2, top + offset)
                
                path.addPath(sub_path)
                
                data = (text_left,
                        top + offset + 1,
                        right,
                        height,
                        Qt.AlignLeft | Qt.AlignVCenter,
                        self.title())
                
                self._textData.append(data)
                
                left = min_left
                top += delta_h
                first = False
        else:
            text = '%s: (%s)' % (self.timeStart().toString('h:mm ap'), 
                                 self.title())
            
            font   = scene.font()
            left   = start_rect.left() + 2 * pad
            top    = start_rect.top() + offset
            
            path.addText(left, top + height / 2, font, text)
        
        # setup the path for this item
        self.setPath(path)
        self.show()
        
        # make sure there are no collisions
        while ( self.collidingItems() ):
            self.setPos(self.pos().x(), self.pos().y() + height + 2)
            
            # hide the item if out of the visible scope
            if ( delta_h - offset <= self.pos().y() + height ):
                self.hide()
                break
902874
def rebuild(self):
        
        table = self.tableType()
        form  = nativestring(self.filterFormat())
        
        if not table and form:
            if self.layout().count() == 0:
                self.layout().addWidget(QLabel(form, self))
            else:
                self.layout().itemAt(0).widget().setText(form)
            return
        
        elif not form:
            return
        
        for child in self.findChildren(QWidget):
            child.close()
            child.setParent(None)
            child.deleteLater()
        
        self.setUpdatesEnabled(False)
        schema = table.schema()
        
        vlayout = self.layout()
        for i in range(vlayout.count()):
            vlayout.takeAt(0)
        
        self._plugins = []
        for line in form.split('\n'):
            row = QHBoxLayout()
            row.setContentsMargins(0, 0, 0, 0)
            row.setSpacing(0)
            
            for label, lookup in FORMAT_SPLITTER.findall(line):
                # create the label
                lbl = QLabel(label, self)
                row.addWidget(lbl)
                
                # create the query plugin
                opts = lookup.split(':')
                if len(opts) == 1:
                    opts.append('is')
                
                column = schema.column(opts[0])
                if not column:
                    continue
                
                plugin = self.pluginFactory().plugin(column)
                if not plugin:
                    continue
                
                editor = plugin.createEditor(self, column, opts[1], None)
                if editor:
                    editor.setObjectName(opts[0])
                    row.addWidget(editor)
                    self._plugins.append((opts[0], opts[1], plugin, editor))
            
            row.addStretch(1)
            vlayout.addLayout(row)
        
        self.setUpdatesEnabled(True)
        self.adjustSize()
1100399
public function rebuild()
    {
        $this->cache->erase();
        $this->reset();
        $this->warmUpCache();
        $this->cache->save();
    }
924105
protected void rebuildTree() {
    final int dim = root.getDimensionality();
    double t = estimateThreshold(root) / leaves;
    t *= t;
    // Never decrease the threshold.
    thresholdsq = t > thresholdsq ? t : thresholdsq;
    LOG.debug("New squared threshold: " + thresholdsq);

    LeafIterator iter = new LeafIterator(root); // Will keep the old root.
    assert (iter.valid());
    ClusteringFeature first = iter.get();

    leaves = 0;
    // Make a new root node:
    root = new TreeNode(dim, capacity);
    root.children[0] = first;
    root.addToStatistics(first);
    ++leaves;
    for(iter.advance(); iter.valid(); iter.advance()) {
      TreeNode other = insert(root, iter.get());
      // Handle root overflow:
      if(other != null) {
        TreeNode newnode = new TreeNode(dim, capacity);
        newnode.addToStatistics(newnode.children[0] = root);
        newnode.addToStatistics(newnode.children[1] = other);
        root = newnode;
      }
    }
  }
1177890
function regenerateObject(root, holder, current, seen, retrieve, undry_paths, old, current_path) {

	var path,
	    temp,
	    key;

	for (key in current) {
		if (current.hasOwnProperty(key)) {
			// Only regenerate if it's not already seen
			if (!seen.get(current[key])) {
				path = current_path.slice(0);
				path.push(key);

				temp = regenerate(root, current, current[key], seen, retrieve, undry_paths, old, path);

				// @TODO: Values returned by `unDry` methods also get regenerated,
				// even though these could contain properties coming from somewhere else,
				// like live HTMLCollections. Assigning anything to that will throw an error.
				// This is a workaround to that proble: if the value is exactly the same,
				// it's not needed to assign it again, so it won't throw an error,
				// but it's not an ideal solution.
				if (temp !== current[key]) {
					current[key] = temp;
				}
			}
		}
	}

	return current;
}
1236882
public function rebuild()
    {
        if (file_exists($this->file)) {
            try {
                $this->data = unserialize(file_get_contents($this->file));
                return true;
            } catch (\Exception $e) {
                // Try just used to suppress the exception. If the cache is corrupted we just start from scratch.
            }
        }

        $this->data = [];
        $this->persist();
        return false;
    }
623939
public void normalize() {
        for (T key : keySet()) {
            setCount(key, getCount(key) / totalCount.get());
        }

        rebuildTotals();
    }
1086197
public function rebuild()
    {
        $this->apply(function($config) {
            $this->rebuildCacheRecord($config, $this->model, 'SUM', $config['columnToSum']);
        });
    }
369906
def rebuild( self ):
        
        plugins.init()
        
        self.blockSignals(True)
        self.setUpdatesEnabled(False)
        
        # clear the old editor
        if ( self._editor ):
            self._editor.close()
            self._editor.setParent(None)
            self._editor.deleteLater()
            self._editor = None
        
        # create a new widget
        plugin_class = plugins.widgets.get(self._columnType)
        if ( plugin_class ):
            self._editor = plugin_class(self)
            self.layout().addWidget(self._editor)
        
        self.blockSignals(False)
        self.setUpdatesEnabled(True)