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

Method _g_copy_rows

tables/table.py:2978–3010  ·  view source on GitHub ↗

Copy rows from self to object.

(
        self,
        obj: Table,
        start: int,
        stop: int,
        step: int,
        sortby: Column | str | None,
        checkCSI: bool,  # noqa: N803
    )

Source from the content-addressed store, hash-verified

2976 self._do_reindex(dirty=True)
2977
2978 def _g_copy_rows(
2979 self,
2980 obj: Table,
2981 start: int,
2982 stop: int,
2983 step: int,
2984 sortby: Column | str | None,
2985 checkCSI: bool, # noqa: N803
2986 ) -> None:
2987 """Copy rows from self to object."""
2988 if sortby is None:
2989 self._g_copy_rows_optim(obj, start, stop, step)
2990 return
2991 lenbuf = self.nrowsinbuf
2992 absstep = step
2993 if step < 0:
2994 absstep = -step
2995 start, stop = stop + 1, start + 1
2996 if sortby is not None:
2997 index = self._check_sortby_csi(sortby, checkCSI)
2998 for start2 in range(start, stop, absstep * lenbuf):
2999 stop2 = start2 + absstep * lenbuf
3000 if stop2 > stop:
3001 stop2 = stop
3002 # The next 'if' is not needed, but it doesn't bother either
3003 if sortby is None:
3004 rows = self[start2:stop2:step]
3005 else:
3006 coords = index[start2:stop2:step]
3007 rows = self.read_coordinates(coords)
3008 # Save the records on disk
3009 obj.append(rows)
3010 obj.flush()
3011
3012 def _g_copy_rows_optim(
3013 self, obj: Table, start: int, stop: int, step: int

Callers 1

_g_copy_with_statsMethod · 0.95

Calls 5

_g_copy_rows_optimMethod · 0.95
_check_sortby_csiMethod · 0.95
read_coordinatesMethod · 0.95
appendMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected