Private part of Leaf.copy() for each kind of leaf.
(
self,
group: Group,
name: str,
start: int,
stop: int,
step: int,
title: str,
filters: Filters | None,
chunkshape: tuple[int, ...] | None,
_log: bool,
**kwargs,
)
| 258 | return self._v_objectid |
| 259 | |
| 260 | def _g_copy_with_stats( |
| 261 | self, |
| 262 | group: Group, |
| 263 | name: str, |
| 264 | start: int, |
| 265 | stop: int, |
| 266 | step: int, |
| 267 | title: str, |
| 268 | filters: Filters | None, |
| 269 | chunkshape: tuple[int, ...] | None, |
| 270 | _log: bool, |
| 271 | **kwargs, |
| 272 | ) -> tuple[CArray, int]: |
| 273 | """Private part of Leaf.copy() for each kind of leaf.""" |
| 274 | start, stop, step = self._process_range_read(start, stop, step) |
| 275 | maindim = self.maindim |
| 276 | shape = list(self.shape) |
| 277 | shape[maindim] = len(range(start, stop, step)) |
| 278 | # Now, fill the new carray with values from source |
| 279 | nrowsinbuf = self.nrowsinbuf |
| 280 | # The slices parameter for self.__getitem__ |
| 281 | slices = [slice(0, dim, 1) for dim in self.shape] |
| 282 | # This is a hack to prevent doing unnecessary conversions |
| 283 | # when copying buffers |
| 284 | self._v_convert = False |
| 285 | # Build the new CArray object |
| 286 | obj = CArray( |
| 287 | group, |
| 288 | name, |
| 289 | atom=self.atom, |
| 290 | shape=shape, |
| 291 | title=title, |
| 292 | filters=filters, |
| 293 | chunkshape=chunkshape, |
| 294 | _log=_log, |
| 295 | ) |
| 296 | # Start the copy itself |
| 297 | for start2 in range(start, stop, step * nrowsinbuf): |
| 298 | # Save the records on disk |
| 299 | stop2 = start2 + step * nrowsinbuf |
| 300 | if stop2 > stop: |
| 301 | stop2 = stop |
| 302 | # Set the proper slice in the main dimension |
| 303 | slices[maindim] = slice(start2, stop2, step) |
| 304 | start3 = (start2 - start) // step |
| 305 | stop3 = start3 + nrowsinbuf |
| 306 | if stop3 > shape[maindim]: |
| 307 | stop3 = shape[maindim] |
| 308 | # The next line should be generalised if, in the future, |
| 309 | # maindim is designed to be different from 0 in CArrays. |
| 310 | # See ticket #199. |
| 311 | obj[start3:stop3] = self.__getitem__(tuple(slices)) |
| 312 | # Activate the conversion again (default) |
| 313 | self._v_convert = True |
| 314 | nbytes = np.prod(self.shape, dtype=SizeType) * self.atom.size |
| 315 | |
| 316 | return (obj, nbytes) |
nothing calls this directly
no test coverage detected