MCPcopy Index your code
hub / github.com/PyTables/PyTables / _write_selection

Method _write_selection

tables/array.py:838–859  ·  view source on GitHub ↗

Write `nparr` in `selection`. Reorder if necessary.

(
        self,
        selection: list[tuple[int, int, int, int, str]],
        reorder: tuple[int, npt.ArrayLike] | None,
        shape: tuple[int, ...],
        nparr: np.ndarray,
    )

Source from the content-addressed store, hash-verified

836 self._g_write_coords(coords, nparr)
837
838 def _write_selection(
839 self,
840 selection: list[tuple[int, int, int, int, str]],
841 reorder: tuple[int, npt.ArrayLike] | None,
842 shape: tuple[int, ...],
843 nparr: np.ndarray,
844 ) -> None:
845 """Write `nparr` in `selection`.
846
847 Reorder if necessary.
848
849 """
850 nparr = self._check_shape(nparr, tuple(shape))
851 # Check whether we should reorder the array
852 if reorder is not None:
853 idx, neworder = reorder
854 k = [slice(None)] * len(shape)
855 k[idx] = neworder
856 # For a reason a don't understand well, we need a copy of
857 # the reordered array
858 nparr = nparr[tuple(k)].copy()
859 self._g_write_selection(selection, nparr)
860
861 def _read(
862 self, start: int, stop: int, step: int, out: np.ndarray | None = None

Callers 1

__setitem__Method · 0.95

Calls 2

_check_shapeMethod · 0.95
copyMethod · 0.45

Tested by

no test coverage detected