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

Method _g_create_common

tables/carray.py:233–258  ·  view source on GitHub ↗

Create a new array in file (common part).

(self, expectedrows: int)

Source from the content-addressed store, hash-verified

231 return self._g_create_common(self.nrows)
232
233 def _g_create_common(self, expectedrows: int) -> int:
234 """Create a new array in file (common part)."""
235 self._v_version = obversion
236
237 if self._v_chunkshape is None:
238 # Compute the optimal chunk size
239 self._v_chunkshape = self._calc_chunkshape(
240 expectedrows, self.rowsize, self.atom.size
241 )
242 # Compute the optimal nrowsinbuf
243 self.nrowsinbuf = self._calc_nrowsinbuf()
244 # Correct the byteorder if needed
245 if self.byteorder is None:
246 self.byteorder = correct_byteorder(self.atom.type, sys.byteorder)
247
248 try:
249 # ``self._v_objectid`` needs to be set because would be
250 # needed for setting attributes in some descendants later
251 # on
252 self._v_objectid = self._create_carray(self._v_new_title)
253 except Exception: # XXX
254 # Problems creating the Array on disk. Close node and re-raise.
255 self.close(flush=0)
256 raise
257
258 return self._v_objectid
259
260 def _g_copy_with_stats(
261 self,

Callers 2

_g_createMethod · 0.95
_g_createMethod · 0.80

Calls 4

correct_byteorderFunction · 0.85
_calc_chunkshapeMethod · 0.45
_calc_nrowsinbufMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected