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

Function read_array_header_2_0

numpy/lib/format.py:513–549  ·  view source on GitHub ↗

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

(fp, max_header_size=_MAX_HEADER_SIZE)

Source from the content-addressed store, hash-verified

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 """
515 Read an array header from a filelike object using the 2.0 file format
516 version.
517
518 This will leave the file object located just after the header.
519
520 .. versionadded:: 1.9.0
521
522 Parameters
523 ----------
524 fp : filelike object
525 A file object or something with a `.read()` method like a file.
526 max_header_size : int, optional
527 Maximum allowed size of the header. Large headers may not be safe
528 to load securely and thus require explicitly passing a larger value.
529 See :py:func:`ast.literal_eval()` for details.
530
531 Returns
532 -------
533 shape : tuple of int
534 The shape of the array.
535 fortran_order : bool
536 The array data will be written out directly if it is either
537 C-contiguous or Fortran-contiguous. Otherwise, it will be made
538 contiguous before writing it out.
539 dtype : dtype
540 The dtype of the file's data.
541
542 Raises
543 ------
544 ValueError
545 If the data is invalid.
546
547 """
548 return _read_array_header(
549 fp, version=(2, 0), max_header_size=max_header_size)
550
551
552def _filter_header(s):

Callers

nothing calls this directly

Calls 1

_read_array_headerFunction · 0.85

Tested by

no test coverage detected