Gets a domain event from the sequence identified by `originator_id`
        at position `eq`.

        :param originator_id: ID of a sequence of events
        :param position: get item at this position
        :return: domain event
768624
def get_domain_event(self, originator_id, position):
        

        sequenced_item = self.record_manager.get_item(
            sequence_id=originator_id,
            position=position,
        )
        return self.mapper.event_from_item(sequenced_item)
1067457
def origin(self):
        
        entry = self._proto.commandQueueEntry
        if entry.cmdId.HasField('origin'):
            return entry.cmdId.origin
        return None
172549
def get_event(self):
        

        if not self.is_event_message:
            return None

        # select a dummy field (eg. subject) to avoid pull unneccesary data
        query = self.q().select('subject').expand('event')

        url = self.build_url(self._endpoints.get('get_message').format(id=self.object_id))

        response = self.con.get(url, params=query.as_params())

        if not response:
            return None

        data = response.json()
        event_data = data.get(self._cc('event'))

        return Event(parent=self, **{self._cloud_data_key: event_data})
1073190
def get_user_identity_ids_by_domain_id(self, domain_id):
        
        query_parameters = {}
        if domain_id is not None:
            query_parameters['domainId'] = self._serialize.query('domain_id', domain_id, 'str')
        response = self._send(http_method='GET',
                              location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7',
                              version='5.0',
                              query_parameters=query_parameters)
        return self._deserialize('[str]', self._unwrap_collection(response))
1106784
def get_event_attendees(self, id, **data):
        
        
        return self.get("/events/{0}/attendees/".format(id), data=data)
736445
def get_event_question(self, id, question_id, **data):
        
        
        return self.get("/events/{0}/questions/{0}/".format(id,question_id), data=data)
22300
def get_record(self, domain, record):
        
        rec_id = utils.get_id(record)
        domain_id = utils.get_id(domain)
        uri = "/domains/%s/records/%s" % (domain_id, rec_id)
        resp, resp_body = self._retry_get(uri)
        resp_body["domain_id"] = domain_id
        return CloudDNSRecord(self, resp_body, loaded=False)
363180
def fetch(cls, id, incident=None, endpoint=None, *args, **kwargs):
        """"""
        if incident is None and endpoint is None:
            raise InvalidArguments(incident, endpoint)

        if endpoint is None:
            iid = incident['id'] if isinstance(incident, Entity) else incident
            endpoint = 'incidents/{0}/alerts'.format(iid)

        return getattr(Entity, 'fetch').__func__(cls, id, endpoint=endpoint,
                                                 *args, **kwargs)
994519
def getEvent(self, name):
        
        to_return = None
        for event in self._observer.caught_events:
            if event["name"] == name:
                to_return = event
                break
        if to_return:
            self._observer.caught_events.remove(to_return)
            self._observer.activate_event(to_return["name"])
        return to_return
949628
def register_new_node(suffix_node_id=None):
    
    node_id = uuid4()
    event = Node.Created(originator_id=node_id, suffix_node_id=suffix_node_id)
    entity = Node.mutate(event=event)
    publish(event)
    return entity
960059
async def _find_trigger(self,
                            request: Request,
                            origin: Optional[Text]=None,
                            internal: bool=False) \
            -> Tuple[
                Optional[BaseTrigger],
                Optional[Type[BaseState]],
                Optional[bool],
            ]:
        

        reg = request.register

        if not origin:
            origin = reg.get(Register.STATE)
            logger.debug('From state: %s', origin)

        results = await asyncio.gather(*(
            x.rank(request, origin)
            for x
            in self.transitions
            if x.internal == internal
        ))

        if len(results):
            score, trigger, state, dnr = max(results, key=lambda x: x[0])

            if score >= settings.MINIMAL_TRIGGER_SCORE:
                return trigger, state, dnr

        return None, None, None
774680
def get_event_action(cls) -> Optional[str]:
        
        if not cls.actor:
            return None
        return event_context.get_event_action(cls.event_type)
1019797
def process_origin(
        headers: Headers, origins: Optional[Sequence[Optional[Origin]]] = None
    ) -> Optional[Origin]:
        
        # "The user agent MUST NOT include more than one Origin header field"
        # per https://tools.ietf.org/html/rfc6454#section-7.3.
        try:
            origin = cast(Origin, headers.get("Origin"))
        except MultipleValuesError:
            raise InvalidHeader("Origin", "more than one Origin header found")
        if origins is not None:
            if origin not in origins:
                raise InvalidOrigin(origin)
        return origin
221867
def get_and_project_events(self, entity_id, gt=None, gte=None, lt=None, lte=None, limit=None, initial_state=None,
                               query_descending=False):
        
        # Decide if query is in ascending order.
        #  - A "speed up" for when events are stored in descending order (e.g.
        #  in Cassandra) and it is faster to get them in that order.
        #  - This isn't useful when 'until' or 'after' or 'limit' are set,
        #    because the inclusiveness or exclusiveness of until and after
        #    and the end of the stream that is truncated by limit both depend on
        #    the direction of the query. Also paging backwards isn't useful, because
        #    all the events are needed eventually, so it would probably slow things
        #    down. Paging is intended to support replaying longer event streams, and
        #    only makes sense to work in ascending order.
        if gt is None and gte is None and lt is None and lte is None and self.__page_size__ is None:
            is_ascending = False
        else:
            is_ascending = not query_descending

        # Get entity's domain events from the event store.
        domain_events = self.event_store.get_domain_events(
            originator_id=entity_id,
            gt=gt,
            gte=gte,
            lt=lt,
            lte=lte,
            limit=limit,
            is_ascending=is_ascending,
            page_size=self.__page_size__
        )

        # The events will be replayed in ascending order.
        if not is_ascending:
            domain_events = list(reversed(list(domain_events)))

        # Project the domain events onto the initial state.
        return self.project_events(initial_state, domain_events)
948390
def item_from_event(self, domain_event_or_events):
        
        # Convert the domain event(s) to sequenced item(s).
        if isinstance(domain_event_or_events, (list, tuple)):
            return [self.item_from_event(e) for e in domain_event_or_events]
        else:
            return self.mapper.item_from_event(domain_event_or_events)
1236061
def fetch(self, origination_number=values.unset):
        
        params = values.of({'OriginationNumber': origination_number, })

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return NumberInstance(
            self._version,
            payload,
            destination_number=self._solution['destination_number'],
        )
1140388
def get(self, node_id):
        
        if (self._registry[node_id].monotonic_timestamp + self.TIMEOUT) < time.monotonic():
            self._call_event_handlers(self.UpdateEvent(self._registry[node_id],
                                                       self.UpdateEvent.EVENT_ID_OFFLINE))
            del self._registry[node_id]
        return self._registry[node_id]