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

Function _add_trailing_padding

numpy/core/_internal.py:816–836  ·  view source on GitHub ↗

Inject the specified number of padding bytes at the end of a dtype

(value, padding)

Source from the content-addressed store, hash-verified

814 names[i] = name
815
816def _add_trailing_padding(value, padding):
817 """Inject the specified number of padding bytes at the end of a dtype"""
818 if value.fields is None:
819 field_spec = dict(
820 names=['f0'],
821 formats=[value],
822 offsets=[0],
823 itemsize=value.itemsize
824 )
825 else:
826 fields = value.fields
827 names = value.names
828 field_spec = dict(
829 names=names,
830 formats=[fields[name][0] for name in names],
831 offsets=[fields[name][1] for name in names],
832 itemsize=value.itemsize
833 )
834
835 field_spec['itemsize'] += padding
836 return dtype(field_spec)
837
838def _prod(a):
839 p = 1

Callers 1

__dtype_from_pep3118Function · 0.85

Calls 1

dtypeFunction · 0.85

Tested by

no test coverage detected