def get_numpy_dtype(obj):
 if (ndarray is not FakeObject):
  import numpy as np
  if (isinstance(obj, np.generic) or isinstance(obj, np.ndarray)):
   try:
    return obj.dtype.type
   except (AttributeError, RuntimeError):
    return

def get_numpy_dtype ( obj ) : if ( ndarray is not FakeObject ) : import numpy as np if ( isinstance ( obj , np . generic ) or isinstance ( obj , np . ndarray ) ) : try : return obj . dtype . type except ( AttributeError , RuntimeError ) : return
return numpy data type associated to obj return none if numpy is not available or if obj is not a numpy array or scalar .