def ufunc_can_cast(from_, to, has_mixed_inputs, casting='safe'):
 from_ = np.dtype(from_)
 to = np.dtype(to)
 if (has_mixed_inputs and (from_.kind in 'iu') and (to.kind in 'cf')):
  return True
 return np.can_cast(from_, to, casting)

def ufunc_can_cast ( from_ , to , has_mixed_inputs , casting = 'safe' ) : from_ = np . dtype ( from_ ) to = np . dtype ( to ) if ( has_mixed_inputs and ( from_ . kind in 'iu' ) and ( to . kind in 'cf' ) ) : return True return np . can_cast ( from_ , to , casting )
a variant of np .