Return arr massaged into a square array. Raises ValueError if arr cannot be
    so massaged.
555630
def as_square_array(arr):
    
    arr = np.atleast_2d(arr)
    if len(arr.shape) != 2 or arr.shape[0] != arr.shape[1]:
        raise ValueError("Expected square array")
    return arr
1072772
function(arr) {
      var n = [], l=arr.length,i;
      for(i = 0 ; i < l ; i++) {
         if( !lang.isNull(arr[i]) && !lang.isUndefined(arr[i]) ) {
            n.push(arr[i]);
         }
      }
      return n;
   }
601933
def str_encode(arr, encoding, errors="strict"):
    
    if encoding in _cpython_optimized_encoders:
        # CPython optimized implementation
        f = lambda x: x.encode(encoding, errors)
    else:
        encoder = codecs.getencoder(encoding)
        f = lambda x: encoder(x, errors)[0]
    return _na_map(f, arr)
942491
def arr_select(value):  # function factory
    '''
    '''
    def f_eq(arr):
        return np.equal(np.bitwise_and(arr, value), value)
    f_eq.__name__ = "arr_bitwise_and_" + str(value)  # or use inspect module: inspect.stack()[0][3]
    return f_eq
1020006
def be_array_to_bytes(arr):
    
    data = fix_byteorder(arr)
    if hasattr(arr, 'tobytes'):
        return data.tobytes()
    else:
        return data.tostring()
979954
def _get_c_valid_arr(self, x):
        
        orig_shape = x.shape
        x = np.ascontiguousarray(x.reshape(orig_shape[0], -1).T)
        return orig_shape, x
261743
def all_strings(arr):
        
        if not isinstance([], list):
            raise TypeError("non-list value found where list is expected")
        return all(isinstance(x, str) for x in arr)
882520
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")

        data = {}
        data['latitude'] = float(array.get('latitude'))
        data['longitude'] = float(array.get('longitude'))
        data['title'] = u(array.get('title'))
        data['address'] = u(array.get('address'))
        data['foursquare_id'] = u(array.get('foursquare_id')) if array.get('foursquare_id') is not None else None
        data['foursquare_type'] = u(array.get('foursquare_type')) if array.get('foursquare_type') is not None else None

        instance = InputVenueMessageContent(**data)
        instance._raw = array
        return instance
523397
def some(arr):
    """"""
    return functools.reduce(lambda x, y: x or (y is not None), arr, False)
469364
function inArray(value, arr) {
    let len = arr.length;
    for (let i = 0; i < len; i++) {
        if (arr[i] == value) {
            return true;
        }
    }
    return false;
}
989841
function cmax( arr ) {
	if ( !Array.isArray( arr ) ) {
		throw new TypeError( 'cmax()::invalid input argument. Must provide an array.' );
	}
	var len = arr.length,
		v = new Array( len ),
		max;

	max = arr[ 0 ];
	v[ 0 ] = max;
	for ( var i = 1; i < len; i++ ) {
		if ( arr[ i ] > max ) {
			max = arr[ i ];
		}
		v[ i ] = max;
	}
	return v;
}
588273
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")

        data = {}
        data['longitude'] = float(array.get('longitude'))
        data['latitude'] = float(array.get('latitude'))
        data['_raw'] = array
        return Location(**data)
139937
public float[] get(float[] arr, int offset) {
        arr[offset+0] = (float)m00;
        arr[offset+1] = (float)m01;
        arr[offset+2] = (float)m02;
        arr[offset+3] = (float)m10;
        arr[offset+4] = (float)m11;
        arr[offset+5] = (float)m12;
        arr[offset+6] = (float)m20;
        arr[offset+7] = (float)m21;
        arr[offset+8] = (float)m22;
        return arr;
    }
1107860
function(arr, func) {
	
	if (arr.map) { return arr.map(func); }
	
	var i, l,
		r = [];
	
	for (i=0, l=arr.length; i<l; i++) {
		r.push(func(arr[i]));
	}
	return r;
}
108662
def process_array(value)
      value.split("\n").map { |s| s.to_s.strip }.compact.select { |s| !s.empty? }
    end
193823
function _flatten (arr) {
  var flat = [];

  for (var i = 0, n = arr.length; i < n; i++) {
    flat = flat.concat(arr[i]);
  }

  return flat;
}
144287
function(arr, num) {
    if (isUndefined(num)) return arr[0];
    if (num < 0) num = 0;
    return arr.slice(0, num);
  }