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

Method __new__

numpy/core/records.py:418–433  ·  view source on GitHub ↗
(subtype, shape, dtype=None, buf=None, offset=0, strides=None,
                formats=None, names=None, titles=None,
                byteorder=None, aligned=False, order='C')

Source from the content-addressed store, hash-verified

416 __module__ = 'numpy'
417
418 def __new__(subtype, shape, dtype=None, buf=None, offset=0, strides=None,
419 formats=None, names=None, titles=None,
420 byteorder=None, aligned=False, order='C'):
421
422 if dtype is not None:
423 descr = sb.dtype(dtype)
424 else:
425 descr = format_parser(formats, names, titles, aligned, byteorder).dtype
426
427 if buf is None:
428 self = ndarray.__new__(subtype, shape, (record, descr), order=order)
429 else:
430 self = ndarray.__new__(subtype, shape, (record, descr),
431 buffer=buf, offset=offset,
432 strides=strides, order=order)
433 return self
434
435 def __array_finalize__(self, obj):
436 if self.dtype.type is not record and self.dtype.names is not None:

Callers

nothing calls this directly

Calls 2

format_parserClass · 0.85
dtypeMethod · 0.45

Tested by

no test coverage detected