csbot.plugins.termdates module

class csbot.plugins.termdates.Term(key: str, start_date: datetime.datetime)[source]

Bases: object

first_monday
last_friday
get_week_number(date: datetime.date) → int[source]

Get the “term week number” of a date relative to this term.

The first week of term is week 1, not week 0. Week 1 starts at the Monday of the term’s start date, even if the term’s start date is not Monday. Any date before the start of the term gives a negative week number.

get_week_start(week_number: int) → datetime.datetime[source]

Get the start date of a specific week number relative to this term.

The first week of term is week 1, not week 0, although this method allows both. When referring to the first week of term, the start date is the term start date (which may not be a Monday). All other weeks start on their Monday.

class csbot.plugins.termdates.TermDates(bot)[source]

Bases: csbot.plugin.Plugin

A wonderful plugin allowing old people (graduates) to keep track of the ever-changing calendar.

DATE_FORMAT = '%Y-%m-%d'
TERM_KEYS = ('aut', 'spr', 'sum')
db_terms

Descriptor for plugin attributes that get (and cache) a value from another plugin.

See Plugin.use().

terms = None
setup()[source]

Plugin setup.

  • Replace all ProvidedByPlugin attributes.
  • Fire all plugin integration methods.
  • Register all commands provided by the plugin.
initialised

If no term dates have been set, the calendar is uninitialised and can’t be asked about term thing.

termdates(e)[source]
week(e)[source]
termdates_set(e)[source]