Create associated 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
1048719
def createAction(self, parent=None, name=''):
        
        action = super(UiLoader, self).createAction(parent, name)
        if not action.parent():
            action.setParent(self._baseinstance)
        setattr(self._baseinstance, name, action)
        return action
130188
def register_custom_actions(parser: argparse.ArgumentParser) -> None:
    """"""
    parser.register('action', None, _StoreRangeAction)
    parser.register('action', 'store', _StoreRangeAction)
    parser.register('action', 'append', _AppendRangeAction)
213768
function addAction(action, ctrl) {
      this.addActionIcon(action, ctrl);
      if (!this.actionExists(action, ctrl)) {
        ctrl.actionListService.requiredActionsList.splice(action.index, 0, action.name);
        ctrl.actionListService.actionsToIndex[action.name] = action.index;
        ctrl.actionListService.onToggle[action.name] = action.onToggle;
        ctrl.actionListService.actionsToDisplay.unshift(action.name);
      }
    }
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)
529006
def action(self, relationship):
        """"""
        action_obj = FileAction(self.xid, relationship)
        self._children.append(action_obj)
19356
def addAction(self, action, checked=None, autoBuild=True):
        
        # clear the holder
        actions = self._actionGroup.actions()
        if actions and actions[0].objectName() == 'place_holder':
            self._actionGroup.removeAction(actions[0])
            actions[0].deleteLater()
        
        # create an action from the name
        if not isinstance(action, QAction):
            action_name = nativestring(action)
            action = QAction(action_name, self)
            action.setObjectName(action_name)
            action.setCheckable(self.isCheckable())
            
            # auto-check the first option
            if checked or (not self._actionGroup.actions() and checked is None):
                action.setChecked(True)
        
        elif self.isCheckable():
            action.setCheckable(True)
            if not self.currentAction():
                action.setChecked(True)
        
        self._actionGroup.addAction(action)
        
        if autoBuild:
            self.rebuild()
        
        return action
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);
            }
        };
    };
}
1317726
function () {
            var self = this;
            base._create.apply(self, arguments);

            if (self.options.actions.listAction) {
                self._adaptListActionforAbp();
            }

            if (self.options.actions.createAction) {
                self._adaptCreateActionforAbp();
            }

            if (self.options.actions.updateAction) {
                self._adaptUpdateActionforAbp();
            }

            if (self.options.actions.deleteAction) {
                self._adaptDeleteActionforAbp();
            }
        }
435141
def create_program_action(parent, text, name, icon=None, nt_name=None):
    """"""
    if is_text_string(icon):
        icon = get_icon(icon)
    if os.name == 'nt' and nt_name is not None:
        name = nt_name
    path = programs.find_program(name)
    if path is not None:
        return create_action(parent, text, icon=icon,
                             triggered=lambda: programs.run_program(name))
1211160
def setup_common_actions(self):
        """"""
        actions = super(ExplorerTreeWidget, self).setup_common_actions()
        if self.show_cd_only is None:
            # Enabling the 'show current directory only' option but do not
            # allow the user to disable it
            self.show_cd_only = True
        else:
            # Show current directory only
            cd_only_action = create_action(self,
                                           _("Show current directory only"),
                                           toggled=self.toggle_show_cd_only)
            cd_only_action.setChecked(self.show_cd_only)
            self.toggle_show_cd_only(self.show_cd_only)
            actions.append(cd_only_action)
        return actions
799074
def execute_action(self, action_name, **options):
        
        assert action_name in NG_ACTIONS, 'wrong action - {0}'.format(action_name)

        action = NG_ACTIONS[action_name]
        self.loop.run_sync(lambda: action.execute(**options), timeout=self.timeout)
178585
def _create_action(factory_self, action_model, resource_name,
                       service_context, is_load=False):
        
        # Create the action in in this closure but before the ``do_action``
        # method below is invoked, which allows instances of the resource
        # to share the ServiceAction instance.
        action = AIOServiceAction(
            action_model, factory=factory_self,
            service_context=service_context
        )

        # A resource's ``load`` method is special because it sets
        # values on the resource instead of returning the response.
        if is_load:
            # We need a new method here because we want access to the
            # instance via ``self``.
            async def do_action(self, *args, **kwargs):
                # response = action(self, *args, **kwargs)
                response = await action.async_call(self, *args, **kwargs)
                self.meta.data = response

            # Create the docstring for the load/reload mehtods.
            lazy_docstring = docstring.LoadReloadDocstring(
                action_name=action_model.name,
                resource_name=resource_name,
                event_emitter=factory_self._emitter,
                load_model=action_model,
                service_model=service_context.service_model,
                include_signature=False
            )
        else:
            # We need a new method here because we want access to the
            # instance via ``self``.
            async def do_action(self, *args, **kwargs):
                response = await action.async_call(self, *args, **kwargs)

                if hasattr(self, 'load'):
                    # Clear cached data. It will be reloaded the next
                    # time that an attribute is accessed.
                    # TODO: Make this configurable in the future?
                    self.meta.data = None

                return response

            lazy_docstring = docstring.ActionDocstring(
                resource_name=resource_name,
                event_emitter=factory_self._emitter,
                action_model=action_model,
                service_model=service_context.service_model,
                include_signature=False
            )

        do_action.__name__ = str(action_model.name)
        do_action.__doc__ = lazy_docstring
        return do_action
810765
def actions(acts, done):
    '''
    
    '''

    def _intermediate(acc, action):
        result = action(acc['state'])
        values = concatv(acc['values'], [result['answer']])

        return {'values': values, 'state': result['state']}

    def _actions(seed):
        init = {'values': [], 'state': seed}

        result = reduce(_intermediate, acts, init)

        keep = remove(lambda x: x is None, result['values'])

        return done(keep, result['state'])

    return _actions
890586
def execute(global_options,options,arguments) 
      get_action(arguments).call(global_options,options,arguments)
    end
248229
def _create_scheduled_actions(conn, as_name, scheduled_actions):
    '''
    
    '''
    if scheduled_actions:
        for name, action in six.iteritems(scheduled_actions):
            if 'start_time' in action and isinstance(action['start_time'], six.string_types):
                action['start_time'] = datetime.datetime.strptime(
                    action['start_time'], DATE_FORMAT
                )
            if 'end_time' in action and isinstance(action['end_time'], six.string_types):
                action['end_time'] = datetime.datetime.strptime(
                    action['end_time'], DATE_FORMAT
                )
            conn.create_scheduled_group_action(as_name, name,
                desired_capacity=action.get('desired_capacity'),
                min_size=action.get('min_size'),
                max_size=action.get('max_size'),
                start_time=action.get('start_time'),
                end_time=action.get('end_time'),
                recurrence=action.get('recurrence')
            )
931190
def setup_menu_actions(self):
        """"""
        self.recent_project_menu.clear()
        self.recent_projects_actions = []
        if self.recent_projects:
            for project in self.recent_projects:
                if self.is_valid_project(project):
                    name = project.replace(get_home_dir(), '~')
                    action = create_action(
                        self,
                        name,
                        icon=ima.icon('project'),
                        triggered=(
                            lambda _, p=project: self.open_project(path=p))
                        )
                    self.recent_projects_actions.append(action)
                else:
                    self.recent_projects.remove(project)
            self.recent_projects_actions += [None,
                                             self.clear_recent_projects_action]
        else:
            self.recent_projects_actions = [self.clear_recent_projects_action]
        add_actions(self.recent_project_menu, self.recent_projects_actions)
        self.update_project_actions()