Returns a formatted dictionary for the given action.
487117
def format(self, action):
        
        item = {
            'id': self.get_uri(action),
            'url': self.get_url(action),
            'verb': action.verb,
            'published': rfc3339_date(action.timestamp),
            'actor': self.format_actor(action),
            'title': text_type(action),
        }
        if action.description:
            item['content'] = action.description
        if action.target:
            item['target'] = self.format_target(action)
        if action.action_object:
            item['object'] = self.format_action_object(action)
        return item
246175
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'generic') and self.generic is not None:
            _dict['generic'] = [x._to_dict() for x in self.generic]
        if hasattr(self, 'intents') and self.intents is not None:
            _dict['intents'] = [x._to_dict() for x in self.intents]
        if hasattr(self, 'entities') and self.entities is not None:
            _dict['entities'] = [x._to_dict() for x in self.entities]
        if hasattr(self, 'actions') and self.actions is not None:
            _dict['actions'] = [x._to_dict() for x in self.actions]
        if hasattr(self, 'debug') and self.debug is not None:
            _dict['debug'] = self.debug._to_dict()
        if hasattr(self, 'user_defined') and self.user_defined is not None:
            _dict['user_defined'] = self.user_defined
        return _dict
866818
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'document') and self.document is not None:
            _dict['document'] = self.document
        if hasattr(self, 'targets') and self.targets is not None:
            _dict['targets'] = self.targets
        return _dict
45228
def query(self, action=None):
        
        if action in self.cache:
            return self.cache[action]['query'].replace('&format=json', '')
        return self.cache.keys() or None
676681
def get_action_meanings(self):
        """"""
        actions = sorted(self._action_meanings.keys())
        return [self._action_meanings[action] for action in actions]
16554
def as_dictionary(self):
        """"""
        values = {
            'id': self._id,
            'type': self._type
        }

        if self._owner:
            values['owner'] = self._owner
        return values
1086478
def shortcuts(self):
        """"""
        return {name: action.shortcut
                for name, action in self._actions_dict.items()}
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
946965
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'feedback') and self.feedback is not None:
            _dict['feedback'] = [x._to_dict() for x in self.feedback]
        return _dict
215862
def _generic_action_parser(self):
        """"""
        actions = []
        while True:
            action_code = unpack_ui8(self._src)
            if action_code == 0:
                break

            action_name = ACTION_NAMES[action_code]
            if action_code > 128:
                # have a payload!
                action_len = unpack_ui16(self._src)
                try:
                    action_meth = getattr(
                        self, "_handle_" + action_name.lower())
                except AttributeError:
                    if self.unknown_alert:
                        raise ValueError(
                            "Unknown action: " + repr(action_name))

                    action_payload = self._src.read(action_len)
                    _dict = {'__str__': _repr, '__repr__': _repr,
                             'name': action_name}
                    action = type("UnknownAction", (SWFObject,), _dict)()
                    action.raw_payload = action_payload
                    actions.append(action)
                else:
                    prev_pos = self._src.tell()
                    for action in action_meth(action_len):
                        assert action is not None, action_name
                        actions.append(action)

                    quant_read = self._src.tell() - prev_pos
                    if quant_read != action_len:
                        raise RuntimeError(
                            "Bad bytes consumption by action {!r} handler "
                            "(did {}, should {})".format(
                                action_name, quant_read, action_len))
            else:
                action = _make_object(action_name)
                actions.append(action)
        return actions
431747
def _get_prefixes_for_action(action):
    
    (technology, permission) = action.split(':')
    retval = ["{}:".format(technology)]
    phrase = ""
    for char in permission:
        newphrase = "{}{}".format(phrase, char)
        retval.append("{}:{}".format(technology,newphrase))
        phrase = newphrase
    return retval
535091
def name(self):
        """"""
        name = getattr(self.action, "__name__", None)
        # ascii(action) not defined for all actions, so must only be evaluated if getattr fails
        return name if name is not None else ascii(self.action)
1153597
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self,
                   'matching_results') and self.matching_results is not None:
            _dict['matching_results'] = self.matching_results
        if hasattr(self, 'hits') and self.hits is not None:
            _dict['hits'] = [x._to_dict() for x in self.hits]
        return _dict
155606
def extract_groups(action_group):
    '''
    
    '''
    return {
        'name': action_group.title,
        'description': action_group.description,
        'items': [action for action in action_group._group_actions
                  if not is_help_message(action)],
        'groups': [extract_groups(group)
                   for group in action_group._action_groups],
        'options': merge(group_defaults,
                               getattr(action_group, 'gooey_options', {}))
    }
291783
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self, 'entities') and self.entities is not None:
            _dict['entities'] = [x._to_dict() for x in self.entities]
        if hasattr(self, 'keywords') and self.keywords is not None:
            _dict['keywords'] = [x._to_dict() for x in self.keywords]
        return _dict
68326
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'size') and self.size is not None:
            _dict['size'] = self.size
        if hasattr(self, 'hits') and self.hits is not None:
            _dict['hits'] = self.hits._to_dict()
        return _dict
991754
def get_es_action_item(data_item, action_settings, es_type, id_field=None):
    '''  '''

    action_item = dict.copy(action_settings)
    if id_field is not None:
        id_val = first(list(get_dict_key(data_item, id_field)))
        if id_val is not None:
            action_item['_id'] = id_val
    elif data_item.get('id'):
        if data_item['id'].startswith("%s/" % action_settings['_index']):
            action_item['_id'] = "/".join(data_item['id'].split("/")[2:])
        else:
            action_item['_id'] = data_item['id']
    if data_item.get('data'):
        action_item['_source'] = data_item['data']
    else:
        action_item['_source'] = data_item
    action_item['_type'] = es_type
    return action_item