def trim(self, top, count=None):
        assert top >= 0, "invalid trim amount %d!"%top
        assert top < self.rows(), "cannot trim %d lines from %d!"%(
            top, self.rows())
        if self.widget_info:
            raise self._finalized_error
        
        if top:
            self.shards = shards_trim_top(self.shards, top)

        if count == 0:
            self.shards = []
        elif count is not None:
            self.shards = shards_trim_rows(self.shards, count)

        self.coords = self.translate_coords(0, -top)
Trim lines from the top and/or bottom of canvas.
dataset/ETHPy150Open AnyMesh/anyMesh-Python/example/urwid/canvas.py/CompositeCanvas.trim