Create a filled array like `a`.
485170
def full_like(a, **kwargs):
    """"""
    _like_args(a, kwargs)
    if isinstance(a, Array):
        kwargs.setdefault('fill_value', a.fill_value)
    return full(**kwargs)
528038
function fillArray(low, high, step, def) {
            step = step || 1;
            var i = [], x;
            for (x = low; x <= high; x += step) {
                i[x] = def === undefined ? x : (typeof def === 'function' ? def(x) : def);
            }
            return i;
        }
435877
function fill(list, value, startIndex=0, endIndex=list.length){
    if (!(list && Array.isArray(list))) {
      // Manually currying
      let args = arguments;
      return (list) => fill(list, ...args);
    }

    return Array(...list).map((x,i)=> {
      if(i>= startIndex && i <= endIndex) {
        return x=value;
      } else {
        return x;
      }
    });
  }
218951
function arrfill(arr, fill) {
  var ind=0, replace = function(i){ return i===undefined ? fill[ind++] : i }
  return _.map(arr, replace).concat(_slice.call(fill, ind))
}
788704
def serialize_array(self, tag):
        """"""
        elements = self.comma.join(f'{el}{tag.item_suffix}' for el in tag)
        return f'[{tag.array_prefix}{self.semicolon}{elements}]'
645089
def _fill(self):
    """"""
    prev = self._head
    super(AutoApplyIterator, self)._fill()
    if self._head is not None:
      self.on_next(self._head, prev)
408275
public static <A> Tuple5<A, A, A, A, A> fill(A a) {
        return tuple(a, a, a, a, a);
    }
852693
public static Matrix constructWithCopy(double[][] A)
    {
        int m = A.length;
        int n = A[0].length;
        Matrix X = new Matrix(m, n);
        double[][] C = X.getArray();
        for (int i = 0; i < m; i++)
        {
            if (A[i].length != n)
            {
                throw new IllegalArgumentException
                        ("All rows must have the same length.");
            }
            for (int j = 0; j < n; j++)
            {
                C[i][j] = A[i][j];
            }
        }
        return X;
    }
1132346
def make_filled_array(shp, dtype, order, r, g, b, a):
    
    # TODO: can we make this more efficient?
    maxv = np.iinfo(dtype).max
    bgval = dict(A=int(maxv * a), R=int(maxv * r), G=int(maxv * g),
                 B=int(maxv * b))
    bgtup = tuple([bgval[order[i]] for i in range(len(order))])
    if dtype is np.uint8 and len(bgtup) == 4:
        # optimiztion when dealing with 32-bit RGBA arrays
        fill_val = np.array(bgtup, dtype=dtype).view(np.uint32)
        rgba = np.zeros(shp, dtype=dtype)
        rgba_i = rgba.view(np.uint32)
        rgba_i[:] = fill_val
        return rgba
    return np.full(shp, bgtup, dtype=dtype)
679994
public static <A> Tuple2<A, A> fill(A a) {
        return tuple(a, a);
    }
1223138
public static void fillCounting(int[] array , int offset, int length ) {
		for (int i = 0; i < length; i++) {
			array[i+offset] = i;
		}
	}
640746
def append(self, value):
        """"""
        self.database.run_script(
            'array_append',
            keys=[self.key],
            args=[value])
45083
def expand_array(data,
                 scans,
                 c_align,
                 c_exp,
                 scan_size=16,
                 tpz_size=16,
                 nties=200,
                 track_offset=0.5,
                 scan_offset=0.5):
    """"""
    nties = np.asscalar(nties)
    tpz_size = np.asscalar(tpz_size)
    s_scan, s_track = da.meshgrid(np.arange(nties * tpz_size),
                                  np.arange(scans * scan_size))
    s_track = (s_track.reshape(scans, scan_size, nties, tpz_size) % scan_size +
               track_offset) / scan_size
    s_scan = (s_scan.reshape(scans, scan_size, nties, tpz_size) % tpz_size +
              scan_offset) / tpz_size

    a_scan = s_scan + s_scan * (1 - s_scan) * c_exp + s_track * (
        1 - s_track) * c_align
    a_track = s_track

    data_a = data[:scans * 2:2, np.newaxis, :-1, np.newaxis]
    data_b = data[:scans * 2:2, np.newaxis, 1:, np.newaxis]
    data_c = data[1:scans * 2:2, np.newaxis, 1:, np.newaxis]
    data_d = data[1:scans * 2:2, np.newaxis, :-1, np.newaxis]

    fdata = ((1 - a_track) *
             ((1 - a_scan) * data_a + a_scan * data_b) + a_track * (
                 (1 - a_scan) * data_d + a_scan * data_c))
    return fdata.reshape(scans * scan_size, nties * tpz_size)
1336842
def _create_array(self, format, args):
        """"""

        builder = None
        if args is None or not args[0]:
            # empty value: we need to call _create() to parse the subtype,
            # and specify the element type precisely
            rest_format = self._create(format[1:], None)[1]
            element_type = format[:len(format) - len(rest_format)]
            builder = GLib.VariantBuilder.new(variant_type_from_string(element_type))
        else:
            builder = GLib.VariantBuilder.new(variant_type_from_string('a*'))
            for i in range(len(args[0])):
                (v, rest_format, _) = self._create(format[1:], args[0][i:])
                builder.add_value(v)
        if args is not None:
            args = args[1:]
        return (builder.end(), rest_format, args)
523029
private function fill()
    {
        foreach ($this->grid as $r => $row) {
            foreach ($row as $c => $cell) {
                if ($cell === null) {
                    $this->grid[$r][$c] = $this->alphabet->randomLetter();
                }
            }
        }
        // fill them
    }
496510
def _ensure_array(self, key, value):
        """"""
        if key not in self._json_dict:
            self._json_dict[key] = []

            self._size += 2             # brackets
            self._ensure_field(key)

        if len(self._json_dict[key]) > 0:
            # this array already has an entry, so add comma and space
            self._size += 2

        if isinstance(value, str):
            self._size += 2  # quotes
        self._size += len(str(value))

        self._json_dict[key].append(value)
1360442
def _pad_arrays(t, arrays, indices, span, period):
    """"""
    N = len(t)

    if indices is None:
        indices = np.arange(N)
    pad_left = max(0, 0 - np.min(indices - span // 2))
    pad_right = max(0, np.max(indices + span - span // 2) - (N - 1))

    if pad_left + pad_right > 0:
        Nright, pad_right = divmod(pad_right, N)
        Nleft, pad_left = divmod(pad_left, N)
        t = np.concatenate([t[N - pad_left:] - (Nleft + 1) * period]
                           + [t + i * period
                              for i in range(-Nleft, Nright + 1)]
                           + [t[:pad_right] + (Nright + 1) * period])
        arrays = [np.concatenate([a[N - pad_left:]]
                                 + (Nleft + Nright + 1) * [a]
                                 + [a[:pad_right]])
                  for a in arrays]
        pad_left = pad_left % N
        Nright = pad_right / N
        pad_right = pad_right % N

        return (t, arrays, slice(pad_left + Nleft * N,
                                 pad_left + (Nleft + 1) * N))
    else:
        return (t, arrays, slice(None))