parameters: (val)
return_statement: return tuple(py_type(v) for v in val)
docstring: Convert numpy val to python primitive equivalent. Ex:
  
      Given: val = np.array([True, False])
      Returns: [True, False]
  
      Given: val = np.array(32, dtype=np.int)
      Returns 32
docstring_summary: Convert numpy val to python primitive equivalent. Ex:
docstring_tokens: Convert numpy val to python primitive equivalent . Ex :
function: def to_py_type(val):
      """Convert numpy val to python primitive equivalent. Ex:
  
      Given: val = np.array([True, False])
      Returns: [True, False]
  
      Given: val = np.array(32, dtype=np.int)
      Returns 32
      """
      if not isinstance(val, (_np.ndarray, _np.generic)):
          return val
      # val is np.ndarray or np.generic
      is_np_scalar = isinstance(val, _np.generic) or val.shape == ()
      py_type = np_dtype_to_py_type(val.dtype)
      if is_np_scalar:
          return py_type(val)
      # flatten them to 1D array
      val = val.flatten()
      return tuple(py_type(v) for v in val)
function_tokens: def to_py_type ( val ) : if not isinstance ( val , ( _np . ndarray , _np . generic ) ) : return val # val is np.ndarray or np.generic is_np_scalar = isinstance ( val , _np . generic ) or val . shape == ( ) py_type = np_dtype_to_py_type ( val . dtype ) if is_np_scalar : return py_type ( val ) # flatten them to 1D array val = val . flatten ( ) return tuple ( py_type ( v ) for v in val )