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

Function _wrap_header_guess_version

numpy/lib/format.py:390–411  ·  view source on GitHub ↗

Like `_wrap_header`, but chooses an appropriate version given the contents

(header)

Source from the content-addressed store, hash-verified

388
389
390def _wrap_header_guess_version(header):
391 """
392 Like `_wrap_header`, but chooses an appropriate version given the contents
393 """
394 try:
395 return _wrap_header(header, (1, 0))
396 except ValueError:
397 pass
398
399 try:
400 ret = _wrap_header(header, (2, 0))
401 except UnicodeEncodeError:
402 pass
403 else:
404 warnings.warn("Stored array in format 2.0. It can only be"
405 "read by NumPy >= 1.9", UserWarning, stacklevel=2)
406 return ret
407
408 header = _wrap_header(header, (3, 0))
409 warnings.warn("Stored array in format 3.0. It can only be "
410 "read by NumPy >= 1.17", UserWarning, stacklevel=2)
411 return header
412
413
414def _write_array_header(fp, d, version=None):

Callers 1

_write_array_headerFunction · 0.85

Calls 2

_wrap_headerFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected