Return the past events in this site.
763419
def _getPastEvents(self, request):
        """"""
        home = request.site.root_page
        return getAllPastEvents(request, home=home)
1297378
def _getNextEventBatch(self):
        """"""
        self._eventPage += 1
        # if we have already obtained all pages, then exit
        if self._totalPages != None and self._eventPage > self._totalPages:
            return
        self.setRequestedResult(RequestEventsInfo(page=self._eventPage, count=self._eventBatchSize,
            sortBy= self._sortBy, sortByAsc=self._sortByAsc,
            returnInfo = self._returnInfo))
        # download articles and make sure that we set the same archive flag as it was returned when we were processing the uriList request
        if self._er._verboseOutput:
            print("Downloading event page %d..." % (self._eventPage))
        res = self._er.execQuery(self)
        if "error" in res:
            print("Error while obtaining a list of events: " + res["error"])
        else:
            self._totalPages = res.get("events", {}).get("pages", 0)
        results = res.get("events", {}).get("results", [])
        self._eventList.extend(results)
1238045
def events(cls, filters):
        """"""
        current = filters.pop('current', False)
        current_params = []
        if current:
            current_params = [('current', 'true')]

        filter_url = uparse.urlencode(sorted(list(filters.items())) + current_params)  # noqa
        events = cls.json_get('%s/events?%s' % (cls.api_url, filter_url),
                              empty_key=True, send_key=False)
        return events
67052
def history(self, dates=None, linreg_since=None, lin_reg_days=20):
        '''
        
        '''
        dates = dates or self.get_dates_range()
        vals = [self.on_date(dt, only_count=True) for dt in dates]
        ret = Series(vals, index=dates)
        if linreg_since is not None:
            ret = self._linreg_future(ret, linreg_since, lin_reg_days)
        return ret.sort_index()
1341597
def events(self):
        ''''''
        ret = []
        while True:
            e = self.poll()
            if e is None:
                break
            ret.append(e)
        return ret
1283764
def _get_events(self):
        
        self.last_update = datetime.datetime.now()
        time_min = datetime.datetime.utcnow()
        time_max = time_min + datetime.timedelta(hours=self.events_within_hours)
        events = []

        try:
            eventsResult = (
                self.service.events()
                .list(
                    calendarId="primary",
                    timeMax=time_max.isoformat() + "Z",  # 'Z' indicates UTC time
                    timeMin=time_min.isoformat() + "Z",  # 'Z' indicates UTC time
                    singleEvents=True,
                    orderBy="startTime",
                )
                .execute(num_retries=5)
            )
        except Exception:
            return self.events or events
        else:
            for event in eventsResult.get("items", []):
                # filter out events that we did not accept (default)
                # unless we organized them with no attendees
                i_organized = event.get("organizer", {}).get("self", False)
                has_attendees = event.get("attendees", [])
                for attendee in event.get("attendees", []):
                    if attendee.get("self") is True:
                        if attendee["responseStatus"] in self.response:
                            break
                else:
                    # we did not organize the event or we did not accept it
                    if not i_organized or has_attendees:
                        continue

                # strip and lower case output if needed
                for key in ["description", "location", "summary"]:
                    event[key] = event.get(key, "").strip()
                    if self.force_lowercase is True:
                        event[key] = event[key].lower()

                # ignore all day events if configured
                if event["start"].get("date") is not None:
                    if self.ignore_all_day_events:
                        continue

                # filter out blacklisted event names
                if event["summary"] is not None:
                    if event["summary"].lower() in map(
                        lambda e: e.lower(), self.blacklist_events
                    ):
                        continue

                events.append(event)

        return events[: self.num_events]
924113
def get_history(self):
        """"""
        if hasattr(self, '_history'):
            return self._history
        try:
            self._history = APICallDayHistory.objects.get(
                user=self.user, creation_date=now().date())
        except APICallDayHistory.DoesNotExist:
            self._history = APICallDayHistory(user=self.user)
            self._history.amount_api_calls = 0
        return self._history
25201
def history(self):
        
        response = self.get("history")
        entries = _load_atom_entries(response)
        if entries is None: return []
        jobs = []
        for entry in entries:
            job = Job(self.service, entry.title)
            jobs.append(job)
        return jobs
687968
def events_list(self):
        
        evt = []
        evt.extend(events.NEPALI_EVENTS[self.month, self.day])
        evt.extend(events.ENGLISH_EVENTS[self.en_date.month, self.en_date.day])
        return evt
212812
def last_event(request, slug):
    ""
    
    try:
        service = Service.objects.get(slug=slug)
    except Service.DoesNotExist:
        return HttpResponseRedirect(reverse('overseer:index'))
    
    try:
        evt = service.event_set.order_by('-date_created')[0]
    except IndexError:
        return HttpResponseRedirect(service.get_absolute_url())
    
    return event(request, evt.pk)
164927
def get_events(self):
        """"""
        to_send = {'limit': 50}
        response = self._send_data('POST', 'admin', 'get-events', to_send)

        output = {'message': ""}
        for event in response['events']:
            desc = "Source IP: {ip}\n"
            desc += "Datetime: {time}\n"
            desc += "Indicator: {match}\n"
            desc += "Method: {method}\n"
            desc += "URL: {url}\n"
            desc += "Request Type: {type}\n"
            desc += "User-Agent: {userAgent}\n"
            desc += "Contact: {contact}\n"
            desc += "\n"
            output['message'] += desc.format(**event)

        return output
104053
def history_list(self, **kwargs):
        """"""
        url_str = self.base_url + '/state-history/'
        if 'dimensions' in kwargs:
            dimstr = self.get_dimensions_url_string(kwargs['dimensions'])
            kwargs['dimensions'] = dimstr
        if kwargs:
            url_str = url_str + '?%s' % parse.urlencode(kwargs, True)
        resp = self.client.list(url_str)
        return resp['elements'] if type(resp) is dict else resp
306030
def history(self):
        
        res = self._api_request('hist')
        if res[0][0] == '-1':
            raise PuushError("History retrieval failed.")
        
        files = []
        for line in res[1:]:
            id, upload_time, url, filename, views, _ = line
            files.append(self._File(id, url, filename, upload_time, views))
        return files
934191
def getAllEvents(request, *, home=None):
    
    qrys = [SimpleEventPage.events(request).all(),
            MultidayEventPage.events(request).all(),
            RecurringEventPage.events(request).all()]
    # Does not return exceptions
    if home is not None:
        qrys = [qry.descendant_of(home) for qry in qrys]
    events = sorted(chain.from_iterable(qrys),
                    key=attrgetter('_first_datetime_from'))
    return events
874633
def get_events(conn, stackname):
    """"""
    next = None
    event_list = []
    while 1:
        events = conn.describe_stack_events(stackname, next)
        event_list.append(events)
        if events.next_token is None:
            break
        next = events.next_token
        time.sleep(1)
    return reversed(sum(event_list, []))
574831
def get_events(self) -> List[Event]:
        
        LOG.debug('Getting events for %s', self.key)
        return get_events(self.key)
939321
def _get_events(self):
        """"""
        events, changed_container_ids = self.docker_util.get_events()
        if not self._disable_net_metrics:
            self._invalidate_network_mapping_cache(events)
        if changed_container_ids and self._service_discovery:
            get_sd_backend(self.agentConfig).update_checks(changed_container_ids)
        if changed_container_ids:
            self.metadata_collector.invalidate_cache(events)
        return events