Module: guest
This module provides objects used to retrieve guests, guest information and
guest details from a copy of the Wait Wait Don't Tell Me! Stats database.
Guest
-
class wwdtm.guest.Guest(connect_dict=None, database_connection=None)
Guest information retrieval class.
Contains methods used to retrieve Not My Job guest information,
including IDs, names, slug strings, appearances and scores.
- Parameters:
connect_dict (dict[str, Any]) -- A dictionary containing database connection
settings as required by MySQL Connector/Python
database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object
-
retrieve_all()
Retrieves guest information for all guests.
- Returns:
A list of dictionaries containing guest ID, name and
slug string for each guest
- Return type:
list[dict[str, int | str]]
-
retrieve_all_details()
Retrieves guest information and appearances for all guests.
- Returns:
A list of dictionaries containing guest ID, name, slug
string, whether the guest is also a host, panelist or
scorekeeper, and a list of appearances with show flags,
scores and scoring exceptions
- Return type:
list[dict[str, Any]]
-
retrieve_all_ids()
Retrieves all guest IDs, sorted by guest name.
- Returns:
A list of guest IDs as integers
- Return type:
list[int]
-
retrieve_all_slugs()
Retrieves all guest slug strings, sorted by guest name.
- Returns:
A list of guest slug strings
- Return type:
list[str]
-
retrieve_by_id(guest_id)
Retrieves guest information.
- Parameters:
guest_id (int) -- Guest ID
- Returns:
A dictionary containing guest ID, name and slug string
- Return type:
dict[str, int | str]
-
retrieve_by_slug(guest_slug)
Retrieves guest information.
- Parameters:
guest_slug (str) -- Guest slug string
- Returns:
A dictionary containing guest ID, name and slug string
- Return type:
dict[str, int | str]
-
retrieve_details_by_id(guest_id)
Retrieves guest information and appearances.
- Parameters:
guest_id (int) -- Guest ID
- Returns:
A dictionary containing guest ID, name, slug string,
whether the guest is also a host, panelist or scorekeeper,
and list of appearances with show flags, scores and scoring
exceptions
- Return type:
dict[str, Any]
-
retrieve_details_by_slug(guest_slug)
Retrieves guest information and appearances.
- Parameters:
guest_slug (str) -- Guest slug string
- Returns:
A dictionary containing guest ID, name, slug string,
whether the guest is also a host, panelist or scorekeeper,
and list of appearances with show flags, scores and scoring
exceptions
- Return type:
dict[str, Any]
-
retrieve_random()
Retrieves information for a random guest.
- Returns:
A dictionary containing guest ID, name and slug string
- Return type:
dict[str, int | str]
-
retrieve_random_details()
Retrieves information and appearances for a random guest.
- Returns:
A dictionary containing guest ID, name, slug string,
whether the guest is also a host, panelist or scorekeeper,
and list of appearances with show flags, scores and scoring
exceptions
- Return type:
dict[str, Any]
-
retrieve_random_id()
Retrieves an ID for a random guest.
- Returns:
ID for a random guest.
- Return type:
int
-
retrieve_random_slug()
Retrieves an slug string for a random guest.
- Returns:
Slug string for a random guest.
- Return type:
str
GuestAppearances
-
class wwdtm.guest.GuestAppearances(connect_dict=None, database_connection=None)
Guest appearance information retrieval class.
Contains methods used to retrieve Not My Job guest appearance
information, scores and scoring exceptions.
- Parameters:
connect_dict (dict[str, Any]) -- A dictionary containing database connection
settings as required by MySQL Connector/Python
database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object
-
retrieve_appearances_by_id(guest_id)
Retrieves guest appearance information.
- Parameters:
guest_id (int) -- Guest ID
- Returns:
A dictionary containing guest appearances with
corresponding show dates, Best Of or Repeat show flags,
score and score exception flag
- Return type:
dict[str, Any]
-
retrieve_appearances_by_slug(guest_slug)
Retrieves guest appearance information.
- Parameters:
guest_slug (str) -- Guest slug string
- Returns:
A dictionary containing guest appearances with
corresponding show dates, Best Of or Repeat show flags,
score and score exception flag
- Return type:
dict[str, Any]
GuestUtility
-
class wwdtm.guest.GuestUtility(connect_dict=None, database_connection=None)
Guest information and utilities class.
Contains methods used to convert between guest ID and slug strings,
and to check if guest IDs and slug strings exist.
- Parameters:
connect_dict (dict[str, Any]) -- A dictionary containing database connection
settings as required by MySQL Connector/Python
database_connection (MySQLConnection | PooledMySQLConnection) -- MySQL database connection object
-
convert_id_to_slug(guest_id)
Converts a guest ID to the corresponding guest slug string.
- Parameters:
guest_id (int) -- Guest ID
- Returns:
Guest slug string if a corresponding value is found.
Otherwise, None is returned
- Return type:
str | None
-
convert_slug_to_id(guest_slug)
Converts a guest slug string to the corresponding guest ID.
- Parameters:
guest_slug (str) -- Guest slug string
- Returns:
Guest ID if a corresponding value is found. Otherwise,
None is returned
- Return type:
int | None
-
id_exists(guest_id)
Validates if a guest ID exists.
- Parameters:
guest_id (int) -- Guest ID
- Returns:
True if the ID exists, otherwise False
- Return type:
bool
-
slug_exists(guest_slug)
Validates if a guest slug string exists.
- Parameters:
guest_slug (str) -- Guest slug string
- Returns:
True if the slug string exists, otherwise False
- Return type:
bool