MCPcopy Create free account
hub / github.com/numpy/numpy / read_array_header_1_0

Function read_array_header_1_0

numpy/lib/format.py:477–511  ·  view source on GitHub ↗

Read an array header from a filelike object using the 1.0 file format version. This will leave the file object located just after the header. Parameters ---------- fp : filelike object A file object or something with a `.read()` method like a file. Returns

(fp, max_header_size=_MAX_HEADER_SIZE)

Source from the content-addressed store, hash-verified

475 _write_array_header(fp, d, (2, 0))
476
477def read_array_header_1_0(fp, max_header_size=_MAX_HEADER_SIZE):
478 """
479 Read an array header from a filelike object using the 1.0 file format
480 version.
481
482 This will leave the file object located just after the header.
483
484 Parameters
485 ----------
486 fp : filelike object
487 A file object or something with a `.read()` method like a file.
488
489 Returns
490 -------
491 shape : tuple of int
492 The shape of the array.
493 fortran_order : bool
494 The array data will be written out directly if it is either
495 C-contiguous or Fortran-contiguous. Otherwise, it will be made
496 contiguous before writing it out.
497 dtype : dtype
498 The dtype of the file's data.
499 max_header_size : int, optional
500 Maximum allowed size of the header. Large headers may not be safe
501 to load securely and thus require explicitly passing a larger value.
502 See :py:func:`ast.literal_eval()` for details.
503
504 Raises
505 ------
506 ValueError
507 If the data is invalid.
508
509 """
510 return _read_array_header(
511 fp, version=(1, 0), max_header_size=max_header_size)
512
513def read_array_header_2_0(fp, max_header_size=_MAX_HEADER_SIZE):
514 """

Callers

nothing calls this directly

Calls 1

_read_array_headerFunction · 0.85

Tested by

no test coverage detected