Action function generator to compute a combination of links

    :return: Versa action function to do the actual work
331473
def foreach(origin=None, rel=None, target=None, attributes=None):
    '''
    
    '''
    def _foreach(ctx):
        '''
        Versa action function utility to compute a list of values from a list of expressions

        :param ctx: Versa context used in processing (e.g. includes the prototype link)
        '''
        _origin = origin(ctx) if callable(origin) else origin
        _rel = rel(ctx) if callable(rel) else rel
        _target = target(ctx) if callable(target) else target
        _attributes = attributes(ctx) if callable(attributes) else attributes
        (o, r, t, a) = ctx.current_link
        o = [o] if _origin is None else (_origin if isinstance(_origin, list) else [_origin])
        r = [r] if _rel is None else (_rel if isinstance(_rel, list) else [_rel])
        t = [t] if _target is None else (_target if isinstance(_target, list) else [_target])
        #a = [a] if _attributes is None else _attributes
        a = [a] if _attributes is None else (_attributes if isinstance(_attributes, list) else [_attributes])
        #print([(curr_o, curr_r, curr_t, curr_a) for (curr_o, curr_r, curr_t, curr_a)
        #            in product(o, r, t, a)])
        return [ ctx.copy(current_link=(curr_o, curr_r, curr_t, curr_a))
                    for (curr_o, curr_r, curr_t, curr_a)
                    in itertools.product(o, r, t, a) ]
        #for (curr_o, curr_r, curr_t, curr_a) in product(origin or [o], rel or [r], target or [t], attributes or [a]):
        #    newctx = ctx.copy(current_link=(curr_o, curr_r, curr_t, curr_a))
            #ctx.output_model.add(I(objid), VTYPE_REL, I(iri.absolutize(_typ, ctx.base)), {})
    return _foreach
628668
function combineChangesets (changesets) {
  const actions = changesets.map((changeset) => changeset.apply)

  const combinedAction = function () {
    const args = arguments

    return actions.reduce((promise, action) => (
      promise.then(() => action.apply(null, args))
    ), Promise.resolve())
  }

  return createChangeset(combinedAction)
}
665039
def get_urls(self):
        
        urls = []

        for action in self.get_extra_actions():
            regex = r'^{}/$'.format(self._get_action_href(action))
            view = self.admin_site.admin_view(action)
            urls.append(url(regex, view))

        return urls + super(ExtraActionsMixin, self).get_urls()
425817
def _create_action(
            self,
            icon_name: Optional[str],
            title: str,
            slot_function: Callable[[None], None],
            tool_tip: Optional[str]=None)-> QAction:
        
        action = QAction(title, self)
        if icon_name:
            action.setIcon(QIcon.fromTheme(icon_name))
        action.triggered.connect(slot_function)
        if tool_tip:
            action.setToolTip(tool_tip)
        return action
869458
def action(arguments):
    
    # Determine file format for input and output
    source_format = (arguments.source_format or
                     fileformat.from_handle(arguments.source_file))
    output_format = (arguments.output_format or
                     fileformat.from_handle(arguments.output_file))

    # Load the alignment
    with arguments.source_file:
        sequences = SeqIO.parse(
            arguments.source_file,
            source_format,
            alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))

        # Locate primers
        (forward_start, forward_end), (reverse_start, reverse_end) = locate_primers(
            sequences, arguments.forward_primer,
            arguments.reverse_primer, arguments.reverse_complement,
            arguments.max_hamming_distance)

        # Generate slice indexes
        if arguments.include_primers:
            start = forward_start
            end = reverse_end + 1
        else:
            start = forward_end + 1
            end = reverse_start

        # Rewind the input file
        arguments.source_file.seek(0)
        sequences = SeqIO.parse(
            arguments.source_file,
            source_format,
            alphabet=Alphabet.Gapped(Alphabet.single_letter_alphabet))

        # Apply the transformation
        prune_action = _ACTIONS[arguments.prune_action]
        transformed_sequences = prune_action(sequences, start, end)

        with arguments.output_file:
            SeqIO.write(transformed_sequences, arguments.output_file,
                        output_format)
371972
function getViewCombinations(action) {
	const pathes = [action];
	const positions = [];
	let i;
	let j;

	for (i = 0; i < action.length; i++) {
		if (action[i] === '-') {
			positions.push(i);
		}
	}

	const len = positions.length;
	const combinations = [];

	for (i = 1; i < (1 << len); i++) {
		const c = [];
		for (j = 0; j < len; j++) {
			if (i & (1 << j)) {
				c.push(positions[j]);
			}
		}
		combinations.push(c);
	}

	combinations.forEach((combination) => {
		let combinationPath = action;
		combination.forEach((pos) => {
			combinationPath = replaceAt(combinationPath, pos, '/');
		});
		pathes.push(combinationPath);
	});
	return pathes;
}
420290
def get_action(self, parent, undo_stack: QUndoStack, sel_range, protocol, view: int):
        
        self.command = ZeroHideAction(protocol, self.following_zeros, view, self.zero_hide_offsets)
        action = QAction(self.command.text(), parent)
        action.triggered.connect(self.action_triggered)
        self.undo_stack = undo_stack
        return action
369087
def _get_action_strings(cls,
                            possible_actions: List[List[ProductionRule]],
                            action_indices: Dict[int, List[List[int]]]) -> List[List[List[str]]]:
        
        all_action_strings: List[List[List[str]]] = []
        batch_size = len(possible_actions)
        for i in range(batch_size):
            batch_actions = possible_actions[i]
            batch_best_sequences = action_indices[i] if i in action_indices else []
            # This will append an empty list to ``all_action_strings`` if ``batch_best_sequences``
            # is empty.
            action_strings = [[batch_actions[rule_id][0] for rule_id in sequence]
                              for sequence in batch_best_sequences]
            all_action_strings.append(action_strings)
        return all_action_strings
615886
def Builder(**kw):
    """"""
    composite = None
    if 'generator' in kw:
        if 'action' in kw:
            raise UserError("You must not specify both an action and a generator.")
        kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {})
        del kw['generator']
    elif 'action' in kw:
        source_ext_match = kw.get('source_ext_match', 1)
        if 'source_ext_match' in kw:
            del kw['source_ext_match']
        if SCons.Util.is_Dict(kw['action']):
            composite = DictCmdGenerator(kw['action'], source_ext_match)
            kw['action'] = SCons.Action.CommandGeneratorAction(composite, {})
            kw['src_suffix'] = composite.src_suffixes()
        else:
            kw['action'] = SCons.Action.Action(kw['action'])

    if 'emitter' in kw:
        emitter = kw['emitter']
        if SCons.Util.is_String(emitter):
            # This allows users to pass in an Environment
            # variable reference (like "$FOO") as an emitter.
            # We will look in that Environment variable for
            # a callable to use as the actual emitter.
            var = SCons.Util.get_environment_var(emitter)
            if not var:
                raise UserError("Supplied emitter '%s' does not appear to refer to an Environment variable" % emitter)
            kw['emitter'] = EmitterProxy(var)
        elif SCons.Util.is_Dict(emitter):
            kw['emitter'] = DictEmitter(emitter)
        elif SCons.Util.is_List(emitter):
            kw['emitter'] = ListEmitter(emitter)

    result = BuilderBase(**kw)

    if not composite is None:
        result = CompositeBuilder(result, composite)

    return result
97763
def actions(self):
        
        actions = []
        do = actions.append

        # determine the number of colors
        colors = self.colors

        # rows and colors
        movements = (
            MoveCarriageToTheRight(KnitCarriage()),
            MoveCarriageToTheLeft(KnitCarriage()))
        rows = self._rows
        first_needles = self._get_row_needles(0)

        # handle switches
        if len(colors) == 1:
            actions.extend([
                SwitchOffMachine(),
                SwitchCarriageToModeNl()])
        else:
            actions.extend([
                SwitchCarriageToModeKc(),
                SwitchOnMachine()])

        # move needles
        do(MoveNeedlesIntoPosition("B", first_needles))
        do(MoveCarriageOverLeftHallSensor())

        # use colors
        if len(colors) == 1:
            do(PutColorInNutA(colors[0]))
        if len(colors) == 2:
            do(PutColorInNutA(colors[0]))
            do(PutColorInNutB(colors[1]))

        # knit
        for index, row in enumerate(rows):
            do(movements[index & 1])
        return actions
1206355
def attach(item, action, greedy=False, ignore_no_tokens=None, ignore_one_token=None):
    """"""
    if use_computation_graph:
        # use the action's annotations to generate the defaults
        if ignore_no_tokens is None:
            ignore_no_tokens = getattr(action, "ignore_no_tokens", False)
        if ignore_one_token is None:
            ignore_one_token = getattr(action, "ignore_one_token", False)
        # only include True keyword arguments in the partial, since False is the default
        kwargs = {}
        if greedy:
            kwargs["greedy"] = greedy
        if ignore_no_tokens:
            kwargs["ignore_no_tokens"] = ignore_no_tokens
        if ignore_one_token:
            kwargs["ignore_one_token"] = ignore_one_token
        action = partial(ComputationNode, action, **kwargs)
    return add_action(item, action)
435062
def partial_append_action(fn, argument_keys=None):
    
    if isinstance(argument_keys, str):
        argument_keys = [argument_keys]
    argument_keys = argument_keys or []

    class PartialAppendAction(argparse.Action):
        def __init__(self,
                     option_strings,
                     dest,
                     const=None,
                     default=None,
                     required=False,
                     help=None,
                     type=None,
                     metavar=None,
                     nargs=None,
                     **kwargs):
            super(PartialAppendAction, self).__init__(
                option_strings=option_strings,
                dest=dest,
                nargs=len(argument_keys),
                const=const,
                default=default,
                required=required,
                metavar=metavar,
                type=type,
                help=help, **kwargs)

        def __call__(self, parser, namespace, values, option_string=None):
            items = copy.copy(getattr(namespace, self.dest, None)) or []

            # If no value was set default to empty list
            if values is None:
                values = []
            elif not isinstance(values, list):
                values = [values]

            if len(argument_keys) != len(values):
                raise ValueError("Unexpected number of values")

            # Generate keyword arguments for the input function
            kwargs = dict(list(zip(argument_keys, values)))
            f = functools.partial(fn, **kwargs)
            items.append(f)
            setattr(namespace, self.dest, items)

    return PartialAppendAction
1354568
function action(targetAction) {
    return function (target, propertyKey, descriptor) {
        if (targetAction == undefined) {
            var metadata = Reflect.getMetadata('design:paramtypes', target, propertyKey);
            if (metadata == undefined || metadata.length < 2)
                throw new Error('@action() must be applied to a function with two arguments. ' +
                    'eg: reducer(state: State, action: SubclassOfAction): State { }');
            targetAction = metadata[1];
        }
        var statexActions = {};
        if (Reflect.hasMetadata(constance_1.STATEX_ACTION_KEY, target)) {
            statexActions = Reflect.getMetadata(constance_1.STATEX_ACTION_KEY, target);
        }
        statexActions[propertyKey] = targetAction;
        Reflect.defineMetadata(constance_1.STATEX_ACTION_KEY, statexActions, target);
        return {
            value: function (state, payload) {
                return descriptor.value.call(this, state, payload);
            }
        };
    };
}
725877
def performAction(self, action):
        
        self._lastAction = []

        n = self.numOffbids * len(self.generators)

        if self.maxWithhold is not None:
            markups = action[:n]
            withholds = action[n:]
        else:
            markups = action
            withholds = [0.0] * n

        self._offbid(markups, withholds)
1156056
def get_plugin_actions(self):
        """"""
        self.history_action = create_action(self, _("History..."),
                                       None, ima.icon('history'),
                                       _("Set history maximum entries"),
                                       triggered=self.change_history_depth)
        self.wrap_action = create_action(self, _("Wrap lines"),
                                    toggled=self.toggle_wrap_mode)
        self.wrap_action.setChecked( self.get_option('wrap') )
        self.linenumbers_action = create_action(
                self, _("Show line numbers"), toggled=self.toggle_line_numbers)
        self.linenumbers_action.setChecked(self.get_option('line_numbers'))

        menu_actions = [self.history_action, self.wrap_action,
                        self.linenumbers_action]
        return menu_actions
174790
def _create_actions(self):
        
        self.action_to_lower = QtWidgets.QAction(self.editor)
        self.action_to_lower.triggered.connect(self.to_lower)
        self.action_to_upper = QtWidgets.QAction(self.editor)
        self.action_to_upper.triggered.connect(self.to_upper)
        self.action_to_lower.setText(_('Convert to lower case'))
        self.action_to_lower.setShortcut('Ctrl+U')
        self.action_to_upper.setText(_('Convert to UPPER CASE'))
        self.action_to_upper.setShortcut('Ctrl+Shift+U')
        self.menu = QtWidgets.QMenu(_('Case'), self.editor)
        self.menu.addAction(self.action_to_lower)
        self.menu.addAction(self.action_to_upper)
        self._actions_created = True
282777
function (generatorFunc) {
            return function () {
                var generator = generatorFunc.apply(this, arguments);
                function doAction(action, arg) {
                    var result;    // in case error on first
                    // in case error on first
                    try {
                        result = generator[action](arg);
                    } catch (e) {
                        return new Reject(e);
                    }
                    if (result.done) {
                        return result.value;
                    }
                    return when(result.value, next, throwEx);
                }
                function next(v) {
                    return doAction('next', v);
                }
                function throwEx(e) {
                    return doAction('throw', e);
                }
                return next();
            };
        }