`masklist` is an array of Bools or equivalent.

        This returns a new DataTable using only the rows that were True
        (or equivalent) in the mask.
494566
def mask(self, masklist):
        
        if not hasattr(masklist, '__len__'):
            masklist = tuple(masklist)

        if len(masklist) != len(self):
            raise Exception("Masklist length (%s) must match length "
                            "of DataTable (%s)" % (len(masklist), len(self)))

        new_datatable = DataTable()
        for field in self.fields:
            new_datatable[field] = list(compress(self[field], masklist))
        return new_datatable
1085351
function(list) {
            if (!isArray(list.value))
                return list;

            var listType, row, rowType;
            rowType  = list.type;
            list     = list.value;
            listType = list[0].type;
            row      = list[0].value;

            list = (isArray(row) ? row : [row]).map(function(col, i) {
                return newLessList(list.map(function(row) {
                    return (isArray(row.value)
                        ? row.value : [row])[i]
                            || new Node();
                }), rowType);
            });

            return newLessList(list, listType);
        }
1169648
def _cellMask(self, index):
        
        row = index.row()
        col = index.column()
        if (row < 0 or row >= self.rowCount() or col < 0 or col >= self.columnCount()):
            return None

        # The check above should have returned None if the sliced array is None
        assert self._slicedArray is not None, "Sanity check failed."

        nFields = len(self._fieldNames)
        mask = self._slicedArray.mask
        if is_an_array(mask):
            if self._separateFieldOrientation == Qt.Horizontal:
                maskValue = mask[row, col // nFields][self._fieldNames[col % nFields]]
            elif self._separateFieldOrientation == Qt.Vertical:
                maskValue = mask[row // nFields, col][self._fieldNames[row % nFields]]
            else:
                maskValue = mask[row, col]
        else:
            maskValue = mask

        # Here maskValue can still be a list in case of structured arrays. It can even still be
        # a numpy array in case of a structured array with sub arrays as fields
        if is_an_array(maskValue):
            allMasked = np.all(maskValue)
        else:
            try:
                allMasked = all(maskValue)
            except TypeError as ex:
                allMasked = bool(maskValue)

        return allMasked
847310
def mask_reduce(mask):
    
    mask = mask.copy()
    for i in range(len(mask.shape)):
        a = mask.copy()
        j = list(range(len(mask.shape)))
        j.remove(i)
        j = tuple(j)
        a = a.max(axis=j, keepdims=True)
        idx = [slice(None)] * len(mask.shape)
        a = a.flatten()
        idx[i] = [k for k in range(len(a)) if a[k]]
        mask = mask[tuple(idx)]
    return mask
1362621
function DataListFilter ( element, datalist, debounce ) {
	this.element  = element;
	this.datalist = datalist;
	this.debounce = debounce;
	this.filters  = {};
}
897024
def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
        
        display_data_channel = self.__display_item.display_data_channel
        shape = display_data_channel.display_data_shape
        mask = numpy.zeros(shape)
        for graphic in self.__display_item.graphics:
            if isinstance(graphic, (Graphics.SpotGraphic, Graphics.WedgeGraphic, Graphics.RingGraphic, Graphics.LatticeGraphic)):
                mask = numpy.logical_or(mask, graphic.get_mask(shape))
        return DataAndMetadata.DataAndMetadata.from_data(mask)
595952
def _makemasks(self, index=None, level=0):
        
        if index is None:
            index = self.index

        try:
            dims = len(array(index).shape)
            if dims == 1:
                index = array(index, ndmin=2).T
        except:
            raise TypeError('A multi-index must be convertible to a numpy ndarray')

        try:
            index = index[:, level]
        except:
            raise ValueError("Levels must be indices into individual elements of the index")

        lenIdx = index.shape[0]
        nlevels = index.shape[1]

        combs = product(*[unique(index.T[i, :]) for i in range(nlevels)])
        combs = array([l for l in combs])

        masks = array([[array_equal(index[i], c) for i in range(lenIdx)] for c in combs])

        return zip(*[(masks[x], combs[x]) for x in range(len(masks)) if masks[x].any()])
1238618
def buildDQMasks(imageObjectList,configObj):
    
    # Insure that input imageObject is a list
    if not isinstance(imageObjectList, list):
        imageObjectList = [imageObjectList]

    for img in imageObjectList:
        img.buildMask(configObj['single'], configObj['bits'])
114654
def replace_list(self, src_list, dest_list, inplace=False, regex=False):
        

        inplace = validate_bool_kwarg(inplace, 'inplace')

        # figure out our mask a-priori to avoid repeated replacements
        values = self.as_array()

        def comp(s, regex=False):
            """
            Generate a bool array by perform an equality check, or perform
            an element-wise regular expression matching
            """
            if isna(s):
                return isna(values)
            if hasattr(s, 'asm8'):
                return _compare_or_regex_search(maybe_convert_objects(values),
                                                getattr(s, 'asm8'), regex)
            return _compare_or_regex_search(values, s, regex)

        masks = [comp(s, regex) for i, s in enumerate(src_list)]

        result_blocks = []
        src_len = len(src_list) - 1
        for blk in self.blocks:

            # its possible to get multiple result blocks here
            # replace ALWAYS will return a list
            rb = [blk if inplace else blk.copy()]
            for i, (s, d) in enumerate(zip(src_list, dest_list)):
                new_rb = []
                for b in rb:
                    m = masks[i][b.mgr_locs.indexer]
                    convert = i == src_len
                    result = b._replace_coerce(mask=m, to_replace=s, value=d,
                                               inplace=inplace,
                                               convert=convert, regex=regex)
                    if m.any():
                        new_rb = _extend_blocks(result, new_rb)
                    else:
                        new_rb.append(b)
                rb = new_rb
            result_blocks.extend(rb)

        bm = self.__class__(result_blocks, self.axes)
        bm._consolidate_inplace()
        return bm
751698
def _calc_mask(self):
    """"""
    mask = []
    for row in self._constraints:
      mask.append(tuple(x is None for x in row))
    return tuple(mask)
193900
def _try_mask_first_value(value, row, all_close):
    '''
    
    '''
    # Compare value to row
    for i, value2 in enumerate(row):
        if _value_equals(value, value2, all_close):
            row[i] = ma.masked
            return True
    return False
567342
def asMaskedArray(self):
        
        return ma.masked_array(data=self.data, mask=self.mask, fill_value=self.fill_value)
1373339
def fill(image, mask=None, iterations=1):
    '''
    '''
    global fill_table
    if mask is None:
        masked_image = image
    else:
        masked_image = image.astype(bool).copy()
        masked_image[~mask] = True
    result = table_lookup(masked_image, fill_table, True, iterations)
    if not mask is None:
        result[~mask] = image[~mask]
    return result
410708
def mask2spans(mask, index=None):
    """"""
    index = list(range(len(mask))) if index is None else index

    mask = pd.Series(mask)
    mask = mask.astype(int).fillna(0).diff().fillna(0)
    starts = list(index[mask > 0])
    stops = list(index[mask < 0])
    if len(stops) == len(starts) - 1:
        stops += [index.values[-1]]
    spans = join_spans(join_spans(zip(starts, stops)))
    return spans
77713
public boolean[] toMaskArray() {
        boolean[] mask = new boolean[args.size()];
        for( int i=0; i<mask.length; i++)
            mask[i] = this.mask.get(i);
        return mask;
    }

    /**
     * Add a masked argument
     * @param string the argument
     */
    public void addMasked(String string) {
        add(string, true);
    }

    public ArgumentListBuilder addMasked(Secret s) {
        return add(Secret.toString(s),true);
    }

    /**
     * Debug/error message friendly output.
     */
    public String toString() {
        StringBuilder buf = new StringBuilder();
        for (int i=0; i<args.size(); i++) {
            String arg = args.get(i);
            if (mask.get(i))
                arg = "******";

            if(buf.length()>0)  buf.append(' ');

            if(arg.indexOf(' ')>=0 || arg.length()==0)
                buf.append('"').append(arg).append('"');
            else
                buf.append(arg);
        }
        return buf.toString();
    }

    private static final long serialVersionUID = 1L;
}
843161
def replaceMaskedValue(data, mask, replacementValue, copyOnReplace=True):
    
    if mask is False:
        result = data
    elif mask is True:
        result = np.copy(data) if copyOnReplace else data
        result[:] = replacementValue
    else:
        #logger.debug("############ count_nonzero: {}".format(np.count_nonzero(mask)))
        if copyOnReplace and np.any(mask):
            #logger.debug("Making copy")
            result = np.copy(data)
        else:
            result = data

        result[mask] = replacementValue

    return result
380294
def table_mask(self):
        """"""
        margin = compress_pruned(
            self._slice.margin(
                axis=None,
                weighted=False,
                include_transforms_for_dims=self._hs_dims,
                prune=self._prune,
            )
        )
        mask = margin < self._size

        if margin.shape == self._shape:
            return mask

        if self._slice.dim_types[0] == DT.MR:
            # If the margin is a column vector - broadcast it's mask to the array shape
            return np.logical_or(np.zeros(self._shape, dtype=bool), mask[:, None])

        return np.logical_or(np.zeros(self._shape, dtype=bool), mask)