Create an action from an action "definition."
776508
function parseAction ({ action, payload={}, error=false }) {
  switch (typeof action) {
    // If it's an action creator, create the action
    case 'function': return action(payload)
    // If it's an action object return the action
    case 'object': return action
    // Otherwise, create a "default" action object with the given type
    case 'string': return { type: action, payload, error }
    default: throw new Error('Invalid action definition (must be function, object or string).')
  }
}
1072607
def register_action(self, action):
        
        assert action.value not in self.actions
        self.actions[action.value] = action
690561
def set_action(self,concept_name,action_meth):
        ''''''
        for concept in self.vocab:
            if concept.name == concept_name:
                concept.action = action_meth
862556
def _add_action(self, action):
        
        kwargs = self._get_method_params()

        kwargs['action'] = action

        self._bulk_actions.append(kwargs)
983068
def action_to_level(action):
    """"""
    try:
        return ACTION_LEVEL_MAP[action]
    except LookupError:
        raise d1_common.types.exceptions.InvalidRequest(
            0, 'Unknown action. action="{}"'.format(action)
        )
1163301
function generateActions({ generate, ...actions }) {
  return !generate
    ? actions
    : Object.assign(
        generate.reduce((obj, name) => {
          obj[name] = forwardValue;
          return obj;
        }, {}),
        actions
      );
}
156557
function actionCreator(modelName, actionName) {
  return data => (
    dispatch({
      type: getFullTypeName(modelName, actionName),
      data
    })
  )
}
1298998
def create(cls, action, **kwargs):
        """"""
        role = kwargs.pop('role', None)
        if role:
            assert role.method == 'system_role'
            kwargs['role_name'] = role.value
        return super(ActionSystemRoles, cls).create(action, **kwargs)
468954
def expand_action(data):
        
        # when given a string, assume user wants to index raw json
        if isinstance(data, string_types):
            return '{"index": {}}', data

        # make sure we don't alter the action
        data = data.copy()
        op_type = data.pop(EsBulk.OP_TYPE, EsBulk.INDEX)

        action = ActionParser._get_relevant_action_params(data, op_type)

        # no data payload for delete
        if op_type == EsBulk.DELETE:
            return action, None

        return action, data.get(EsDocProperties.SOURCE, data)
930732
def get_action(self, action):
        """"""
        func_name = action.replace('-', '_')
        if not hasattr(self, func_name):
            # Function doesn't exist
            raise DaemonError(
                'Invalid action "{action}"'.format(action=action))

        func = getattr(self, func_name)
        if (not hasattr(func, '__call__') or
                getattr(func, '__daemonocle_exposed__', False) is not True):
            # Not a function or not exposed
            raise DaemonError(
                'Invalid action "{action}"'.format(action=action))

        return func
209212
def action(action_callback=None, **kwargs):
    

    if action_callback is None:
        return lambda fn: action(fn, **kwargs)
    else:
        return Action(action_callback, **kwargs).decorate_module(action_callback)
482970
def dispatch(self, *args, **kwargs):
        """"""
        action = kwargs.pop('action', 'default')
        action_method = getattr(self, str(action), self.default)
        return action_method(*args, **kwargs)
1256966
def expand_actions(self, actions):
        """"""
        results = list()

        for action in actions:
            if action in self.aliased_actions:
                results.append(action)
                for item in self.expand_actions(self.aliased_actions[action]):
                    results.append(item)
            else:
                results.append(action)

        return results
1251360
def request(self, action):
    """"""
    ev = threading.Event()
    first = False
    with self.__lock:
      if len(self.__events) == 0:
        first = True
      self.__events.append(ev)
    if first:
      action()
    return ev
526521
def create_action(parent, text, shortcut=None, icon=None, tip=None,
                  toggled=None, triggered=None, data=None, menurole=None,
                  context=Qt.WindowShortcut):
    """"""
    action = QAction(text, parent)
    if triggered is not None:
        action.triggered.connect(triggered)
    if toggled is not None:
        action.toggled.connect(toggled)
        action.setCheckable(True)
    if icon is not None:
        action.setIcon(icon)
    if shortcut is not None:
        action.setShortcut(shortcut)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    if data is not None:
        action.setData(to_qvariant(data))
    if menurole is not None:
        action.setMenuRole(menurole)
    #TODO: Hard-code all shortcuts and choose context=Qt.WidgetShortcut
    # (this will avoid calling shortcuts from another dockwidget
    #  since the context thing doesn't work quite well with these widgets)
    action.setShortcutContext(context)
    return action
1358198
def make_annotation(self):
        """"""
        annotation = dict()

        # Put all properties of the action object into the annotation
        for item in dir(self):
            if len(item) > 0 and item[0] != '_' and \
                    not inspect.ismethod(getattr(self, item)):
                annotation[item] = getattr(self, item)

        return annotation
567691
def create_actions(MAIN):
    """"""
    actions = MAIN.action  # actions was already taken

    """ ------ OPEN SETTINGS ------ """
    actions['open_settings'] = QAction(QIcon(ICON['settings']), 'Settings',
                                       MAIN)
    actions['open_settings'].triggered.connect(MAIN.show_settings)

    """ ------ CLOSE WINDOW ------ """
    actions['close_wndw'] = QAction(QIcon(ICON['quit']), 'Quit', MAIN)
    actions['close_wndw'].triggered.connect(MAIN.close)

    """ ------ ABOUT ------ """
    actions['about'] = QAction('About WONAMBI', MAIN)
    actions['about'].triggered.connect(MAIN.about)

    actions['aboutqt'] = QAction('About Qt', MAIN)
    actions['aboutqt'].triggered.connect(lambda: QMessageBox.aboutQt(MAIN))