MCPcopy Create free account
hub / github.com/PyTables/PyTables / _g_copy_rows_optim

Method _g_copy_rows_optim

tables/table.py:3012–3031  ·  view source on GitHub ↗

Copy rows from self to object (optimized version).

(
        self, obj: Table, start: int, stop: int, step: int
    )

Source from the content-addressed store, hash-verified

3010 obj.flush()
3011
3012 def _g_copy_rows_optim(
3013 self, obj: Table, start: int, stop: int, step: int
3014 ) -> None:
3015 """Copy rows from self to object (optimized version)."""
3016 nrowsinbuf = self.nrowsinbuf
3017 obj._open_append(self._v_iobuf)
3018 nrowsdest = obj.nrows
3019 for start2 in range(start, stop, step * nrowsinbuf):
3020 # Save the records on disk
3021 stop2 = start2 + step * nrowsinbuf
3022 if stop2 > stop:
3023 stop2 = stop
3024 # Optimized version (it saves some conversions)
3025 nrows = ((stop2 - start2 - 1) // step) + 1
3026 self.row._fill_col(self._v_iobuf, start2, stop2, step, None)
3027 # The output buffer is created anew,
3028 # so the operation is safe to in-place conversion.
3029 obj._append_records(nrows)
3030 nrowsdest += nrows
3031 obj._close_append()
3032
3033 def _g_prop_indexes(self, other: Table) -> None:
3034 """Generate index in `other` table for every indexed column here."""

Callers 1

_g_copy_rowsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected