def wrap(self, availWidth, availHeight):
        "All table properties should be known by now."

        # makes an internal table which does all the work.
        # we draw the LAST RUN's entries!  If there are
        # none, we make some dummy data to keep the table
        # from complaining
        if len(self._lastEntries) == 0:
            if '2.3' <= reportlab.Version:
                _tempEntries = [(0, 'Placeholder for table of contents', 0)]
            else:
                _tempEntries = [(0, 'Placeholder for table of contents',
                                 0, None)]
        else:
            _tempEntries = self._lastEntries

        if _tempEntries:
            base_level = _tempEntries[0][0]
        else:
            base_level = 0

        def drawTOCEntryEnd(canvas, kind, label):
            '''Callback to draw dots and page numbers after each entry.'''

            style, page, key, dot = end_info[int(label)]
            drawPageNumbers(canvas, style, [(page, key)], availWidth, availHeight, dot)

        toc_counter = self.toc_counter
        toc_counter[0] += 1
        funcname = 'drawTOCEntryEnd%s' % toc_counter[0]
        setattr(self.canv, funcname, drawTOCEntryEnd)

        end_info = []
        tableData = []
        for entry in _tempEntries:
            level, text, pageNum = entry[:3]
            left_col_level = level - base_level
            if reportlab.Version > '2.3': # For ReportLab post-2.3
                style=self.getLevelStyle(left_col_level)
            else: # For ReportLab <= 2.3
                style = self.levelStyles[left_col_level]

            if self.dotsMinLevel >= 0 and left_col_level >= self.dotsMinLevel:
                dot = ' . '
            else:
                dot = ''

            style = copy(style)
            style.textColor = self.linkColor
            key = self.refid_lut.get((level, text, pageNum), None)
            if key:
                if not isinstance(text, unicode):
                    text = unicode(text, 'utf-8')
                text = u'<a href="#%s">%s</a>' % (key, text)

            para = Paragraph('%s<onDraw name="%s" label="%s"/>' % (text, funcname, len(end_info)), style)
            end_info.append((style, pageNum, key, dot))
            if style.spaceBefore:
                tableData.append([Spacer(1, style.spaceBefore),])
            tableData.append([para,])

        self._table = Table(tableData, colWidths=(availWidth,), style=self.tableStyle)

        self.width, self.height = self._table.wrapOn(self.canv,availWidth, availHeight)
        return (self.width, self.height)
dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/extensions/dotted_toc.py/DottedTableOfContents.wrap/swapped operands of `<=`