Fetch events meeting specified criteria
979395
def events(self, **kwargs):
        
        events_result = self.service.events().list(**kwargs).execute()
        return [Event(event) for event in events_result.get("items", [])]
87178
def list_events_view(request):
    '''  '''
    page_name = "Upcoming Events"
    profile = UserProfile.objects.get(user=request.user)
    event_form = EventForm(
        request.POST if 'post_event' in request.POST else None,
        profile=profile,
    )
    if event_form.is_valid():
        event_form.save()
        return HttpResponseRedirect(reverse('events:list'))

    # a pseudo-dictionary, actually a list with items of form (event, ongoing,
    # rsvpd, rsvp_form), where ongoing is a boolean of whether the event is
    # currently ongoing, rsvpd is a boolean of whether the user has rsvp'd to
    # the event
    events_dict = list()
    for event in Event.objects.filter(end_time__gte=now()):
        rsvp_form = RsvpForm(
            request.POST if "rsvp-{0}".format(event.pk) in request.POST else None,
            instance=event,
            profile=profile,
        )
        if rsvp_form.is_valid():
            rsvpd = rsvp_form.save()
            if rsvpd:
                message = MESSAGES['RSVP_ADD'].format(event=event.title)
            else:
                message = MESSAGES['RSVP_REMOVE'].format(event=event.title)
            messages.add_message(request, messages.SUCCESS, message)
            return HttpResponseRedirect(reverse('events:list'))

        ongoing = ((event.start_time <= now()) and (event.end_time >= now()))
        rsvpd = (profile in event.rsvps.all())
        events_dict.append((event, ongoing, rsvpd, rsvp_form))

    if request.method == "POST":
        messages.add_message(request, messages.ERROR, MESSAGES["EVENT_ERROR"])

    return render_to_response('list_events.html', {
        'page_name': page_name,
        'events_dict': events_dict,
        'now': now(),
        'event_form': event_form,
    }, context_instance=RequestContext(request))
470312
function listEvents(req, res, next){
  var logger = log.logger;
  var EventModel = models.getModels().Event;
  var listReq = RequestTranslator.parseListEventsRequest(req);
  if(! listReq.uid || ! listReq.env || ! listReq.domain){
    return next({"error":"invalid params missing uid env or domain","code":400});
  }
  EventModel.queryEvents(listReq.uid, listReq.env, listReq.domain, function(err, events){
    if(err) {
      logger.error(loggerPrefix + 'Events Query Error: ', err);
      return next(err);
    } else {
      req.resultData =  ResponseTranslator.mapEventsToResponse(events);
      next();
    }
  });
}
586041
def events_for_date_range(start_d, end_d, find_options = {})
      self.scoped(find_options).find(
        :all,
        :conditions => [ "(? <= #{self.quoted_table_name}.#{self.end_at_field}) AND (#{self.quoted_table_name}.#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ],
        :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC"
      )
    end
913013
def _get_records(event):
    """"""
    try:
        recs, _ = unpack_kinesis_event(event, deserializer=None)
    except KeyError:
        # If not a Kinesis event, just unpack the records
        recs = event["Records"]
    return recs
214558
def getGroupUpcomingEvents(request, group):
    
    # Get events that are a child of a group page, or a postponement or extra
    # info a child of the recurring event child of the group
    rrEvents = RecurringEventPage.events(request).exclude(group_page=group) \
                                        .upcoming().child_of(group).this()
    qrys = [SimpleEventPage.events(request).exclude(group_page=group)
                                        .upcoming().child_of(group).this(),
            MultidayEventPage.events(request).exclude(group_page=group)
                                        .upcoming().child_of(group).this(),
            rrEvents]
    for rrEvent in rrEvents:
        qrys += [PostponementPage.events(request).child_of(rrEvent.page)
                                         .upcoming().this(),
                 ExtraInfoPage.events(request).exclude(extra_title="")
                                 .child_of(rrEvent.page).upcoming().this()]

    # Get events that are linked to a group page, or a postponement or extra
    # info a child of the recurring event linked to a group
    rrEvents = group.recurringeventpage_set(manager='events').auth(request)  \
                                                        .upcoming().this()
    qrys += [group.simpleeventpage_set(manager='events').auth(request)
                                                        .upcoming().this(),
             group.multidayeventpage_set(manager='events').auth(request)
                                                        .upcoming().this(),
             rrEvents]
    for rrEvent in rrEvents:
        qrys += [PostponementPage.events(request).child_of(rrEvent.page)
                                                       .upcoming().this(),
                 ExtraInfoPage.events(request).exclude(extra_title="")
                                 .child_of(rrEvent.page).upcoming().this()]
    events = sorted(chain.from_iterable(qrys),
                    key=attrgetter('page._upcoming_datetime_from'))
    return events
143591
def _getEventsByDay(self, request, firstDay, lastDay):
        
        return getAllEventsByDay(request, firstDay, lastDay, home=self)
1191109
async def get_events(
        self, device_ids, group_ids=None, from_time=None, to_time=None, event_types=None
    ):
        """"""
        if to_time is None:
            to_time = datetime.utcnow()
        if from_time is None:
            from_time = to_time - timedelta(seconds=EVENT_INTERVAL)
        if event_types is None:
            event_types = ["allEvents"]

        get_params = []

        get_params.extend([("deviceId", value) for value in device_ids])
        if group_ids is not None:
            get_params.extend([("groupId", value) for value in group_ids])
        get_params.extend([("from", from_time.isoformat() + "Z")])
        get_params.extend([("to", to_time.isoformat() + "Z")])
        get_params.extend([("type", value) for value in event_types])

        data = await self.api("reports/events", get_params)

        if self.connected and self.authenticated:
            self._events = data
        else:
            self._events = self._events

        return self._events
706954
private Events<Event> getEvents(CanalEventStore eventStore, Position start, int batchSize, Long timeout,
                                    TimeUnit unit) {
        if (timeout == null) {
            return eventStore.tryGet(start, batchSize);
        } else {
            try {
                if (timeout <= 0) {
                    return eventStore.get(start, batchSize);
                } else {
                    return eventStore.get(start, batchSize, timeout, unit);
                }
            } catch (Exception e) {
                throw new CanalServerException(e);
            }
        }
    }
810039
def fetchone(table, cols="*", where=(), group="", order=(), limit=(), **kwargs):
    """"""
    return select(table, cols, where, group, order, limit, **kwargs).fetchone()
943880
def get_allEvents(self):
        '''
        
        '''

        if not hasattr(self,'allEvents'):
            timeFilters = {'endTime__gte': timezone.now()}
            if getConstant('registration__displayLimitDays') or 0 > 0:
                timeFilters['startTime__lte'] = timezone.now() + timedelta(days=getConstant('registration__displayLimitDays'))

            # Get the Event listing here to avoid duplicate queries
            self.allEvents = Event.objects.filter(
                **timeFilters
            ).filter(
                Q(instance_of=PublicEvent) |
                Q(instance_of=Series)
            ).annotate(
                **self.get_annotations()
            ).exclude(
                Q(status=Event.RegStatus.hidden) |
                Q(status=Event.RegStatus.regHidden) |
                Q(status=Event.RegStatus.linkOnly)
            ).order_by(*self.get_ordering())

        return self.allEvents
397871
def _fetch_events_files_on_disk(self):
    
    all_files = tf.io.gfile.listdir(self._events_directory)
    relevant_files = [
        file_name for file_name in all_files
        if _DEBUGGER_EVENTS_FILE_NAME_REGEX.match(file_name)
    ]
    return sorted(relevant_files, key=self._obtain_file_index)
42637
def get_user_events(self, id, **data):
        
        
        return self.get("/users/{0}/events/".format(id), data=data)
145260
def get_events(self, **kwargs):
        """"""
        force = kwargs.pop('force', False)
        response = api.request_sync_events(self.blink,
                                           self.network_id,
                                           force=force)
        try:
            return response['event']
        except (TypeError, KeyError):
            _LOGGER.error("Could not extract events: %s",
                          response,
                          exc_info=True)
            return False
107095
async function fetchAll(connection, query, params){

    // execute query
    const [result] = await _query(connection, query, params);

    // entry found ?
    return result || [];
}
360436
def events(self, all_instances=None, instance_ids=None, filters=None):
        """"""
        params = {}
        if filters:
            params["filters"] = make_filters(filters)
        if instance_ids:
            params['InstanceIds'] = instance_ids
        statuses = self.status(all_instances, **params)
        event_list = []
        for status in statuses:
            if status.get("Events"):
                for event in status.get("Events"):
                    event[u"InstanceId"] = status.get('InstanceId')
                    event_list.append(event)
        return event_list
799954
def _getEventFromUid(self, request, uid):
        """"""
        event = getEventFromUid(request, uid)
        if event.get_ancestors().filter(id=self.id).exists():
            # only return event if it is a descendant
            return event