Decorate a Table read method to apply ``selection`` keyword
172983
def read_with_selection(func):
    
    def wrapper(*args, **kwargs):
        """Execute a function, then apply a selection filter
        """
        # parse selection
        selection = kwargs.pop('selection', None) or []

        # read table
        tab = func(*args, **kwargs)

        # apply selection
        if selection:
            return filter_table(tab, selection)

        return tab

    return _safe_wraps(wrapper, func)
337390
def readTable(self, tableName):
        
        lock_and_call(
            lambda: self._impl.readTable(tableName),
            self._lock
        )
674453
function handleRowColSelectionChange(rowOrCol) {
        var decoratorsField = ('_' + rowOrCol + 'SelectionClasses');
        model[decoratorsField].forEach(function (selectionDecorator) {
            grid.cellClasses.remove(selectionDecorator);
        });
        model[decoratorsField] = [];

        if (grid[rowOrCol + 'Model'].allSelected()) {
            var top = rowOrCol === 'row' ? Infinity : 0;
            var left = rowOrCol === 'col' ? Infinity : 0;
            var decorator = grid.cellClasses.create(top, left, 'selected', 1, 1, 'virtual');
            grid.cellClasses.add(decorator);
            model[decoratorsField].push(decorator);
        } else {
            grid[rowOrCol + 'Model'].getSelected().forEach(function (index) {
                var virtualIndex = grid[rowOrCol + 'Model'].toVirtual(index);
                var top = rowOrCol === 'row' ? virtualIndex : 0;
                var left = rowOrCol === 'col' ? virtualIndex : 0;
                var decorator = grid.cellClasses.create(top, left, 'selected', 1, 1, 'virtual');
                grid.cellClasses.add(decorator);
                model[decoratorsField].push(decorator);
            });
        }
    }
1061474
def addReader(self, selectable):
        """"""
        try:
            self._reads[selectable].resume()
        except KeyError:
            self._reads[selectable] = g = Stream.spawn(self, selectable, 'doRead')
            self.addToGreenletPool(g)
817504
def _cache_key_select_daterange(method, self, field_id, field_title, style=None):
    
    key = update_timer(), field_id, field_title, style
    return key
411337
def select(table, index_track, field_name, op, value, includeMissing):
    '''
    '''
    result = []
    result_index = []
    counter = 0
    for row in table:
        if detect_fields(field_name, convert_to_dict(row)):
            final_value = get_value(row, field_name)
            if do_op(final_value, op, value):
                result.append(row)
                result_index.append(index_track[counter])
        else:
            if includeMissing:
                result.append(row)
                result_index.append(index_track[counter])
        counter += 1
    #table = result
    #index_track = result_index
    return (result, result_index)
1242730
def table_from_root(source, treename=None, columns=None, **kwargs):
    
    import root_numpy

    # parse column filters into tree2array ``selection`` keyword
    # NOTE: not all filters can be passed directly to root_numpy, so we store
    #       those separately and apply them after-the-fact before returning
    try:
        selection = kwargs.pop('selection')
    except KeyError:  # no filters
        filters = None
    else:
        rootfilters = []
        filters = []
        for col, op_, value in parse_column_filters(selection):
            try:
                opstr = [key for key in OPERATORS if OPERATORS[key] is op_][0]
            except (IndexError, KeyError):  # cannot filter with root_numpy
                filters.append((col, op_, value))
            else:  # can filter with root_numpy
                rootfilters.append('{0} {1} {2!r}'.format(col, opstr, value))
        kwargs['selection'] = ' && '.join(rootfilters)

    # pass file name (not path)
    if not isinstance(source, string_types):
        source = source.name

    # find single tree (if only one tree present)
    if treename is None:
        trees = root_numpy.list_trees(source)
        if len(trees) == 1:
            treename = trees[0]
        elif not trees:
            raise ValueError("No trees found in %s" % source)
        else:
            raise ValueError("Multiple trees found in %s, please select on "
                             "via the `treename` keyword argument, e.g. "
                             "`treename='events'`. Available trees are: %s."
                             % (source, ', '.join(map(repr, trees))))

    # read, filter, and return
    t = Table(root_numpy.root2array(
        source,
        treename,
        branches=columns,
        **kwargs
    ))
    if filters:
        return filter_table(t, *filters)
    return t
404139
function(e, oSelf) {
    var sMode = oSelf.get("selectionMode");

    if(sMode == "standard") {
        oSelf._handleStandardSelectionByKey(e);
    }
    else if(sMode == "single") {
        oSelf._handleSingleSelectionByKey(e);
    }
    else if(sMode == "cellblock") {
        oSelf._handleCellBlockSelectionByKey(e);
    }
    else if(sMode == "cellrange") {
        oSelf._handleCellRangeSelectionByKey(e);
    }
    else if(sMode == "singlecell") {
        oSelf._handleSingleCellSelectionByKey(e);
    }
    
    if(oSelf._oCellEditor) {
        if(oSelf._oCellEditor.fireEvent) {
            oSelf._oCellEditor.fireEvent("blurEvent", {editor: oSelf._oCellEditor});
        }
        else if(oSelf._oCellEditor.isActive) {
            oSelf.fireEvent("editorBlurEvent", {editor:oSelf._oCellEditor});
        }
    }

    var elTarget = Ev.getTarget(e);
    var elTag = elTarget.nodeName.toLowerCase();
    var bKeepBubbling = true;
    while(elTarget && (elTag != "table")) {
        switch(elTag) {
            case "body":
                return;
            case "tbody":
                bKeepBubbling = oSelf.fireEvent("tbodyKeyEvent",{target:elTarget,event:e});
                break;
            default:
                break;
        }
        if(bKeepBubbling === false) {
            return;
        }
        else {
            elTarget = elTarget.parentNode;
            if(elTarget) {
                elTag = elTarget.nodeName.toLowerCase();
            }
        }
    }
    oSelf.fireEvent("tableKeyEvent",{target:(elTarget || oSelf._elContainer),event:e});
}
1366176
private void paintRowSelectionElement(final WDataTable table, final XmlStringBuilder xml) {
		boolean multiple = table.getSelectMode() == SelectMode.MULTIPLE;

		xml.appendTagOpen("ui:rowselection");
		xml.appendOptionalAttribute("multiple", multiple, "true");

		if (multiple) {
			switch (table.getSelectAllMode()) {
				case CONTROL:
					xml.appendAttribute("selectAll", "control");
					break;
				case TEXT:
					xml.appendAttribute("selectAll", "text");
					break;
				case NONE:
					break;
				default:
					throw new SystemException("Unknown select-all mode: " + table.
							getSelectAllMode());
			}
		}

		xml.appendOptionalAttribute("groupName", table.getSelectGroup());
		xml.appendEnd();
	}
168875
def selection(self):
        """"""
        sel = QtGui.QItemSelection()
        for index in self.selectedIndexes():
            sel.select(index, index)
        return sel
1018098
def Decorate(cls, class_name, member, parent_member):
    """"""
    if isinstance(member, property):
      fget = cls.DecorateMethod(class_name, member.fget, parent_member)
      fset = None
      if member.fset:
        fset = cls.DecorateMethod(class_name, member.fset, parent_member)
      fdel = None
      if member.fdel:
        fdel = cls.DecorateMethod(class_name, member.fdel, parent_member)
      return property(fget, fset, fdel, member.__doc__)
    else:
      return cls.DecorateMethod(class_name, member, parent_member)
84064
def read_with_columns(func):
    
    def wrapper(*args, **kwargs):
        # parse columns argument
        columns = kwargs.pop("columns", None)

        # read table
        tab = func(*args, **kwargs)

        # filter on columns
        if columns is None:
            return tab
        return tab[columns]

    return _safe_wraps(wrapper, func)
30429
function fixTableCellSelection() {
        function tableCellSelected(ed, rng, n, currentCell) {
          // The decision of when a table cell is selected is somewhat involved.  The fact that this code is
          // required is actually a pointer to the root cause of this bug. A cell is selected when the start
          // and end offsets are 0, the start container is a text, and the selection node is either a TR (most cases)
          // or the parent of the table (in the case of the selection containing the last cell of a table).
          var TEXT_NODE = 3, table = ed.dom.getParent(rng.startContainer, 'TABLE');
          var tableParent, allOfCellSelected, tableCellSelection;

          if (table) {
            tableParent = table.parentNode;
          }

          allOfCellSelected = rng.startContainer.nodeType == TEXT_NODE &&
            rng.startOffset === 0 &&
            rng.endOffset === 0 &&
            currentCell &&
            (n.nodeName == "TR" || n == tableParent);

          tableCellSelection = (n.nodeName == "TD" || n.nodeName == "TH") && !currentCell;

          return allOfCellSelected || tableCellSelection;
        }

        function fixSelection() {
          var rng = editor.selection.getRng();
          var n = editor.selection.getNode();
          var currentCell = editor.dom.getParent(rng.startContainer, 'TD,TH');

          if (!tableCellSelected(editor, rng, n, currentCell)) {
            return;
          }

          if (!currentCell) {
            currentCell = n;
          }

          // Get the very last node inside the table cell
          var end = currentCell.lastChild;
          while (end.lastChild) {
            end = end.lastChild;
          }

          // Select the entire table cell. Nothing outside of the table cell should be selected.
          if (end.nodeType == 3) {
            rng.setEnd(end, end.data.length);
            editor.selection.setRng(rng);
          }
        }

        editor.on('KeyDown', function () {
          fixSelection();
        });

        editor.on('MouseDown', function (e) {
          if (e.button != 2) {
            fixSelection();
          }
        });
      }
1200001
function decorateElement(element) {
  const hasMissingTabIndex = Boolean(!element.getAttribute('tabindex') && element.tabIndex === -1);

  if (hasMissingTabIndex) {
    elementsWithMissingTabIndex.push(element);
    element.tabIndex = 0;
  }
}
1361204
def OnSelectReader(self, reader):
        """"""
        SimpleSCardAppEventObserver.OnSelectReader(self, reader)
        self.feedbacktext.SetLabel('Selected reader: ' + repr(reader))
406453
def selections(self):
        ""
        for key, value in self.pairs:
            if '__' in key:
                column, lookup = key.rsplit('__', 1)
            else:
                column = key
                lookup = 'exact'
            yield column, lookup, value
270919
function decorateWithReadConcern(command, coll, options) {
  if (options && options.session && options.session.inTransaction()) {
    return;
  }
  let readConcern = Object.assign({}, command.readConcern || {});
  if (coll.s.readConcern) {
    Object.assign(readConcern, coll.s.readConcern);
  }

  if (Object.keys(readConcern).length > 0) {
    Object.assign(command, { readConcern: readConcern });
  }
}