#NEWLINE# def _normalize_default( value , dtype ) : #NEWLINE# #INDENT# 'Return `value` as a valid default of NumPy type `dtype`.' #NEWLINE# if ( value is None ) : #NEWLINE# #INDENT# value = 0 #NEWLINE# #UNINDENT# basedtype = dtype . base #NEWLINE# try : #NEWLINE# #INDENT# default = numpy . array ( value , dtype = basedtype ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# array = numpy . array ( value ) #NEWLINE# if ( array . shape != basedtype . shape ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# default = numpy . array ( array , dtype = basedtype . base ) #NEWLINE# #UNINDENT# if ( default . shape == ( ) ) : #NEWLINE# #INDENT# default = default [ ( ) ] #NEWLINE# #UNINDENT# return default