コード例 #1
0
def index():
	import itertools
	key = lambda c: c.year

	parts = sorted(CourseYear.iter(), key=key, reverse=True)
	parts_by_year = itertools.groupby(parts, key)

	return dict(parts=parts_by_year)
コード例 #2
0
                events.append(
                    icalendar.Event(
                        summary=icalendar.vText(
                            '{}: {}'.format(lab.code, lab.name) if any(
                                c.isdigit() for c in lab.code) else lab.name),
                        location=icalendar.vText(
                            "{} - {}".format(lab.location, cued_address)
                            if lab.location else cued_address),
                        dtstart=icalendar.vDatetime(
                            timezone.localize(startt).astimezone(pytz.utc)),
                        dtend=icalendar.vDatetime(
                            timezone.localize(endt).astimezone(pytz.utc)),
                        dtstamp=icalendar.vDatetime(last_updated),
                        uid='{code}-{i}.d{day}.{term}.{part}@efw27.user.srcf.net'
                        .format(i=i,
                                code=lab.code,
                                day=(day - timetable.dates[0]).days,
                                term=term,
                                part=course_year.part),
                        description=icalendar.vText(
                            '{}Feedback: http://www-g.eng.cam.ac.uk/ssjc/labs.html'
                            .format("Information: {}\n\n".
                                    format(lab.link) if lab.link else ""))))

    return events


if __name__ == '__main__':
    from objects import CourseYear
    print(construct(CourseYear.get('ib', 2014), 'lent', '142-144').to_ical())
コード例 #3
0
def ia_term_calendar(year, part, term, group):
	course_year = CourseYear.get(part, year)
	return calendarmaker.construct(course_year, term, group)
コード例 #4
0
def ia_term_calendar(year, part, term):
	course_year = CourseYear.get(part, year)
	return calendarmaker.construct(timetable, term, examples=True)
コード例 #5
0
def ia_term_table(year, part, term):
	timetable = CourseYear.get(part, year).term(term)
	return dict(tt=timetable)
コード例 #6
0
					),
					location=icalendar.vText(
						"{} - {}".format(lab.location, cued_address)
						if lab.location else
						cued_address
					),
					dtstart=icalendar.vDatetime(timezone.localize(startt).astimezone(pytz.utc)),
					dtend=  icalendar.vDatetime(timezone.localize(endt).astimezone(pytz.utc)),
					dtstamp=icalendar.vDatetime(last_updated),

					uid='{code}-{i}.d{day}.{term}.{part}@efw27.user.srcf.net'.format(
						i=i,
						code=lab.code,
						day=(day - timetable.dates[0]).days,
						term=term,
						part=course_year.part
					),

					description=icalendar.vText(
						'{}Feedback: http://www-g.eng.cam.ac.uk/ssjc/labs.html'.format(
							"Information: {}\n\n".format(lab.link) if lab.link else ""
						)
					)
				))

	return events

if __name__ == '__main__':
	from objects import CourseYear
	print(construct(CourseYear.get('ib', 2014), 'lent', '142-144').to_ical())