Displays a list of all upcoming events in this site.
481811
def subsite_upcoming_events(context):
    
    request = context['request']
    home = request.site.root_page
    return {'request': request,
            'events':  getAllUpcomingEvents(request, home=home)}
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]
1277511
def dashboard_view(request, show_widgets=True, show_expired=False, ignore_dashboard_types=None, show_welcome=False):
    """"""

    user = request.user

    announcements_admin = user.has_admin_permission("announcements")
    events_admin = user.has_admin_permission("events")

    if not show_expired:
        show_expired = ("show_expired" in request.GET)

    show_all = (request.GET.get("show_all", "0") != "0")
    if "show_all" not in request.GET and request.user.is_eighthoffice:
        # Show all by default to 8th period office
        show_all = True

    # Include show_all postfix on next/prev links
    paginate_link_suffix = "&show_all=1" if show_all else ""
    is_index_page = (request.path_info in ["/", ""])

    context = {
        "prerender_url": get_prerender_url(request),
        "user": user,
        "announcements_admin": announcements_admin,
        "events_admin": events_admin,
        "is_index_page": is_index_page,
        "show_all": show_all,
        "paginate_link_suffix": paginate_link_suffix,
        "show_expired": show_expired
    }

    # Get list of announcements
    items = get_announcements_list(request, context)

    # Paginate announcements list
    context, items = paginate_announcements_list(request, context, items)

    user_hidden_announcements = (Announcement.objects.hidden_announcements(user).values_list("id", flat=True))
    user_hidden_events = (Event.objects.hidden_events(user).values_list("id", flat=True))

    if ignore_dashboard_types is None:
        ignore_dashboard_types = []

    context.update({
        "hide_announcements": True,
        "hide_events": True,
        "user_hidden_announcements": user_hidden_announcements,
        "user_hidden_events": user_hidden_events,
        "ignore_dashboard_types": ignore_dashboard_types
    })

    is_student = user.is_student
    is_teacher = user.is_teacher
    is_senior = user.is_senior
    is_global_admin = user.member_of("admin_all") and user.is_superuser
    show_admin_widget = is_global_admin or announcements_admin or user.is_eighth_admin
    eighth_sponsor = user.get_eighth_sponsor()

    # the URL path for forward/back buttons
    view_announcements_url = "index"

    if show_widgets:
        dashboard_title = "Dashboard"
        dashboard_header = "Dashboard"
    elif show_expired:
        dashboard_title = dashboard_header = "Announcement Archive"
        view_announcements_url = "announcements_archive"
    else:
        dashboard_title = dashboard_header = "Announcements"

    num_senior_destinations = len(Senior.objects.filled())

    try:
        dash_warning = settings.DASH_WARNING
    except Exception:
        dash_warning = None

    # TODO: resolve circular dependency
    from ..auth.views import get_ap_week_warning
    fcps_emerg = get_fcps_emerg(request)
    ap_week = get_ap_week_warning(request)
    if fcps_emerg:
        dash_warning = fcps_emerg
    elif ap_week:
        dash_warning = ap_week

    context.update({
        "dash_warning": dash_warning,
        "show_widgets": show_widgets,
        "show_expired": show_expired,
        "view_announcements_url": view_announcements_url,
        "dashboard_title": dashboard_title,
        "dashboard_header": dashboard_header,
        "is_student": is_student,
        "is_teacher": is_teacher,
        "is_senior": is_senior,
        "is_global_admin": is_global_admin,
        "show_admin_widget": show_admin_widget,
        "eighth_sponsor": eighth_sponsor,
        "num_senior_destinations": num_senior_destinations
    })

    if settings.TJSTAR_MAP:
        context.update(get_tjstar_mapping(request.user))

    if show_widgets:
        context = add_widgets_context(request, context)

    if announcements_admin:
        all_waiting = AnnouncementRequest.objects.filter(posted=None, rejected=False).this_year()
        awaiting_teacher = all_waiting.filter(teachers_approved__isnull=True)
        awaiting_approval = all_waiting.filter(teachers_approved__isnull=False)

        context.update({"awaiting_teacher": awaiting_teacher, "awaiting_approval": awaiting_approval})

    self_awaiting_teacher = AnnouncementRequest.objects.filter(posted=None, rejected=False, teachers_requested=request.user).this_year()
    context.update({"self_awaiting_teacher": self_awaiting_teacher})

    if show_welcome:
        return render(request, "welcome/student.html", context)
    else:
        return render(request, "dashboard/dashboard.html", context)
1243503
def events(ctx, eventgroup):
    
    eg = EventGroup(eventgroup, peerplays_instance=ctx.peerplays)
    click.echo(pretty_print(eg.events, ctx=ctx))
620921
protected static function events()
    {
        foreach (self::fetch('app/events', false) as $file) {
            Bus::need($file);
        }
        //
        Event::register();
    }
875067
public function listEventsAction()
    {
        $this->checkStaticTemplateIsIncluded();
        $this->checkSettings();

        $this->slotExtendedAssignMultiple([
            self::VIEW_VARIABLE_ASSOCIATION_ID => $this->settings[self::SETTINGS_ASSOCIATION_ID],
            self::VIEW_VARIABLE_FILTER => $this->getEventsFilter()
        ], __CLASS__, __FUNCTION__);

        return $this->view->render();
    }
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
858490
def events(self):
        
        events = [self.acknowledge_event] + self.verification_events
        return [x for x in events if x]
809540
def get_events(self):
        
        return github.PaginatedList.PaginatedList(
            github.IssueEvent.IssueEvent,
            self._requester,
            self.url + "/events",
            None,
            headers={'Accept': Consts.mediaTypeLockReasonPreview}
        )
1129781
def getAllUpcomingEvents(request, *, home=None):
    
    qrys = [SimpleEventPage.events(request).upcoming().this(),
            MultidayEventPage.events(request).upcoming().this(),
            RecurringEventPage.events(request).upcoming().this(),
            PostponementPage.events(request).upcoming().this(),
            ExtraInfoPage.events(request).exclude(extra_title="").upcoming()
                                         .this()]
    if home is not None:
        qrys = [qry.descendant_of(home) for qry in qrys]
    events = sorted(chain.from_iterable(qrys),
                    key=attrgetter('page._upcoming_datetime_from'))
    return events
1166242
def list(self):
        '''
        
        '''
        kwd = {
            'pager': '',
            'title': '单页列表',
        }
        self.render('wiki_page/page_list.html',
                    kwd=kwd,
                    view=MWiki.query_recent(),
                    view_all=MWiki.query_all(),
                    format_date=tools.format_date,
                    userinfo=self.userinfo,
                    cfg=CMS_CFG)
740422
def paginate_announcements_list(request, context, items):
    

    # pagination
    if "start" in request.GET:
        try:
            start_num = int(request.GET.get("start"))
        except ValueError:
            start_num = 0
    else:
        start_num = 0

    display_num = 10
    end_num = start_num + display_num
    prev_page = start_num - display_num
    more_items = ((len(items) - start_num) > display_num)
    try:
        items_sorted = items[start_num:end_num]
    except (ValueError, AssertionError):
        items_sorted = items[:display_num]
    else:
        items = items_sorted

    context.update({
        "items": items,
        "start_num": start_num,
        "end_num": end_num,
        "prev_page": prev_page,
        "more_items": more_items,
    })

    return context, items
1069759
def watch_for_events():
    """"""
    fd = inotify.init()
    try:
        wd = inotify.add_watch(fd, '/tmp', inotify.IN_CLOSE_WRITE)
        while True:
            for event in inotify.get_events(fd):
                print("event:", event.name, event.get_mask_description())
    finally:
        os.close(fd)
528557
function buildEvent (id, title, display, hidden = {}) {
  const eventObj = {
    id,
    title,
    display,
    hidden,
    status: 'active',
    timestamp: new Date(Date.now()).toISOString()
  };
  return eventObj;
}
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
216687
def list(self, where):
        '''
        
        '''
        if where == 'pillar':
            schedule = self._get_schedule(include_opts=False)
        elif where == 'opts':
            schedule = self._get_schedule(include_pillar=False)
        else:
            schedule = self._get_schedule()

        # Fire the complete event back along with the list of schedule
        evt = salt.utils.event.get_event('minion', opts=self.opts, listen=False)
        evt.fire_event({'complete': True, 'schedule': schedule},
                       tag='/salt/minion/minion_schedule_list_complete')
854931
def list_events(self):
    
    event_dir_dict = collections.defaultdict(set)

    for event_file in self._glob_events_files(self._paths, recursive=True):
      dir = os.path.dirname(event_file)
      try:
        for record in tf_record.tf_record_iterator(event_file):
          event = event_pb2.Event.FromString(record)
          if event.summary is None or event.summary.value is None:
            continue
          for value in event.summary.value:
            if value.simple_value is None or value.tag is None:
              continue
            event_dir_dict[value.tag].add(dir)
      except tf.errors.DataLossError:
        # DataLossError seems to happen sometimes for small logs.
        # We want to show good records regardless.
        continue
    return dict(event_dir_dict)