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

Method _check_shape_append

tables/earray.py:194–216  ·  view source on GitHub ↗

Test that nparr shape is consistent with underlying EArray.

(self, nparr: np.ndarray)

Source from the content-addressed store, hash-verified

192 return self._g_create_common(self._v_expectedrows)
193
194 def _check_shape_append(self, nparr: np.ndarray) -> None:
195 """Test that nparr shape is consistent with underlying EArray."""
196 # Does the array conform to self expandibility?
197 myrank = len(self.shape)
198 narank = len(nparr.shape) - len(self.atom.shape)
199 if myrank != narank:
200 raise ValueError(
201 (
202 "the ranks of the appended object (%d) and the "
203 "``%s`` EArray (%d) differ"
204 )
205 % (narank, self._v_pathname, myrank)
206 )
207 for i in range(myrank):
208 if i != self.extdim and self.shape[i] != nparr.shape[i]:
209 raise ValueError(
210 (
211 "the shapes of the appended object and the "
212 "``%s`` EArray differ in non-enlargeable "
213 "dimension %d"
214 )
215 % (self._v_pathname, i)
216 )
217
218 def append(self, sequence: npt.ArrayLike) -> None:
219 """Add a sequence of data to the end of the dataset.

Callers 1

appendMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected