def _reformat(p, buf):
if numpy.ndim(buf) != <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if hasattr(p, '<STR_LIT>'):<EOL><INDENT>ans = _gvar.BufferDict(p)<EOL>if ans.size != len(buf):<EOL><INDENT>raise ValueError(       <EOL>"<STR_LIT>"%(ans.size, len(buf)))<EOL><DEDENT>ans = _gvar.BufferDict(ans, buf=buf)<EOL><DEDENT>else:<EOL><INDENT>if numpy.size(p) != len(buf):<EOL><INDENT>raise ValueError(       <EOL>"<STR_LIT>"%(numpy.size(p), len(buf)))<EOL><DEDENT>ans = numpy.array(buf).reshape(numpy.shape(p))<EOL><DEDENT>return ans<EOL>
Apply format of ``p`` to data in 1-d array ``buf``.