Assign the intersecting region from ``rhs_arr`` to ``lhs_arr``.
434115
def _assign_intersection(lhs_arr, rhs_arr, offset):
    """"""
    lhs_slc, rhs_slc = _intersection_slice_tuples(lhs_arr, rhs_arr, offset)
    lhs_arr[lhs_slc] = rhs_arr[rhs_slc]
934544
def _rhat_ufunc(ary):
    
    target = np.empty(ary.shape[:-2])
    for idx in np.ndindex(target.shape):
        target[idx] = _get_split_rhat(ary[idx])
    return target
691015
def offset(self, location, dy=0):
        
        if not isinstance(location, Location):
            # Assume variables passed were dx,dy
            location = Location(location, dy)
        r = Region(self.x+location.x, self.y+location.y, self.w, self.h).clipRegionToScreen()
        if r is None:
            raise ValueError("Specified region is not visible on any screen")
            return None
        return r
813598
public static <T> void swap(T[] arr, int a, int b) {
		if (a < 0 || a > arr.length || b < 0 || b > arr.length)
			throw new IllegalArgumentException("swap position out of bounds.");
		if (a != b) {
			T t = arr[a];
			arr[a] = arr[b];
			arr[b] = t;
		}
	}
1024471
def visit_assign(self, node):
        """"""
        lhs = " = ".join(n.accept(self) for n in node.targets)
        return "%s = %s" % (lhs, node.value.accept(self))
234516
def replaceRDiagonal(d, arr)
      d = d.to_i
      (0...arr.length).each do |i|
        xy = rDiagonalXY(d, i)
        self[xy['x'], xy['y']] = arr[i]
      end
    end
182149
def intersect(self, other):
        
        if not self.overlap(other):
            return None

        newstart = max(self._start, other.start)
        newend = min(self._end, other.end)
        return Range(newstart, newend)
449886
private void intersectionMatrix(int[][] res, ArrayList<int[]> partsx, ArrayList<int[]> partsy, int gridsize) {
    for(int x = 0; x < gridsize; x++) {
      final int[] px = partsx.get(x);
      final int[] rowx = res[x];
      for(int y = 0; y < gridsize; y++) {
        int[] py = partsy.get(y);
        rowx[y] = intersectionSize(px, py);
      }
    }
  }
850268
def move_to(self, r):
        '''
        '''
        dx = r - self.r_array[0]
        self.r_array += dx
44639
def expand_region(tuple_of_s, a, b, start=0, stop=None):
    ''''''
    return tuple(expand_slice(s, a, b, start=start, stop=stop)
                 for s in tuple_of_s)
183559
function flattenRX(arr, code,  res) {
  if(!Array.isArray(arr)) return arr_push(res, arr);

  let codex = arr[0];
  if( code !== codex) { 
    let r = flattenRX(arr,codex, [codex]);
    return ( res ) ? arr_push(res, r) : r;
  }
  
  return arr.reduce( (res,a) => flattenRX(a, codex, res));
}
1110160
def set(self, value, start=None, stop=None):
		""""""
		_check_start_stop(start, stop)
		# start_index, stop_index will denote the sections we are replacing
		start_index = self._bisect_left(start)
		if start is not None:  # start_index == 0
			prev_value = self._values[start_index - 1]
			if prev_value == value:
				# We're setting a range where the left range has the same
				# value, so create one big range
				start_index -= 1
				start = self._keys[start_index]
		if stop is None:
			new_keys = [start]
			new_values = [value]
			stop_index = len(self._keys)
		else:
			stop_index = self._bisect_right(stop)
			stop_value = self._values[stop_index - 1]
			stop_key = self._keys[stop_index - 1]
			if stop_key == stop and stop_value == value:
				new_keys = [start]
				new_values = [value]
			else:
				new_keys = [start, stop]
				new_values = [value, stop_value]
		self._keys[start_index:stop_index] = new_keys
		self._values[start_index:stop_index] = new_values
776513
def Assign(target, source):
    """"""
    if not isinstance(target, list):
        target = [target]
    if not isinstance(source, list):
        source.prefix = u" "
        source = [source]

    return Node(syms.atom,
                target + [Leaf(token.EQUAL, u"=", prefix=u" ")] + source)
144378
protected void mergeSmallRegions() {
		for( int i = 0; i < edgesNotMatched.size(); i++ ) {
			Edge e = edgesNotMatched.get(i);

			int rootA = find(e.indexA);
			int rootB = find(e.indexB);

			// see if they are already part of the same segment
			if( rootA == rootB )
				continue;

			int sizeA = regionSize.get(rootA);
			int sizeB = regionSize.get(rootB);

			// merge if one of the regions is too small
			if( sizeA < minimumSize || sizeB < minimumSize ) {
				// Point everything towards rootA
				graph.data[e.indexB] = rootA;
				graph.data[rootB] = rootA;

				// Update the size of regionA
				regionSize.data[rootA] = sizeA + sizeB;
			}
		}
	}
1053774
public void setRegion(int left, int top, int width, int height) {
    if (top < 0 || left < 0) {
      throw new IllegalArgumentException("Left and top must be nonnegative");
    }
    if (height < 1 || width < 1) {
      throw new IllegalArgumentException("Height and width must be at least 1");
    }
    int right = left + width;
    int bottom = top + height;
    if (bottom > this.height || right > this.width) {
      throw new IllegalArgumentException("The region must fit inside the matrix");
    }
    for (int y = top; y < bottom; y++) {
      int offset = y * rowSize;
      for (int x = left; x < right; x++) {
        bits[offset + (x / 32)] |= 1 << (x & 0x1f);
      }
    }
  }
1249369
private static Node normalizeAssignmentOp(Node n) {
    Node lhs = n.getFirstChild();
    Node rhs = n.getLastChild();
    Node newRhs = new Node(NodeUtil.getOpFromAssignmentOp(n),
        lhs.cloneTree(), rhs.cloneTree()).srcrefTree(n);
    return replace(n, IR.assign(lhs.cloneTree(), newRhs).srcrefTree(n));
  }
469002
def _slice_area_from_bbox(self, src_area, dst_area, ll_bbox=None,
                              xy_bbox=None):
        """"""
        if ll_bbox is not None:
            dst_area = AreaDefinition(
                'crop_area', 'crop_area', 'crop_latlong',
                {'proj': 'latlong'}, 100, 100, ll_bbox)
        elif xy_bbox is not None:
            dst_area = AreaDefinition(
                'crop_area', 'crop_area', 'crop_xy',
                src_area.proj_dict, src_area.x_size, src_area.y_size,
                xy_bbox)
        x_slice, y_slice = src_area.get_area_slices(dst_area)
        return src_area[y_slice, x_slice], y_slice, x_slice