Module: scorekeeper

This module provides objects used to retrieve scorekeepers, scorekeeper information and scorekeeper details from a copy of the Wait Wait Don't Tell Me! Stats database.

Scorekeeper

class wwdtm.scorekeeper.Scorekeeper(connect_dict=None, database_connection=None)

Scorekeeper information retrieval class.

Contains methods used to retrieve scorekeeper information, including IDs, names, slug strings and appearances.

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 scorekeeper information for all scorekeepers.

Returns:

A list of dictionaries containing scorekeeper ID, name, gender, pronouns and slug string for each scorekeeper

Return type:

list[dict[str, Any]]

retrieve_all_details()

Retrieves scorekeeper information and appearances for all scorekeepers.

Returns:

A list of dictionaries containing scorekeeper ID, name, slug string, gender, pronouns, whether the scorekeeper is also a guest, host or panelist, and a list of appearances with show flags for each scorekeeper

Return type:

list[dict[str, Any]]

retrieve_all_ids()

Retrieves all scorekeeper IDs, sorted by scorekeeper name.

Returns:

A list of scorekeeper IDs as integers

Return type:

list[int]

retrieve_all_slugs()

Retrieves all scorekeeper slug strings, sorted by scorekeeper name.

Returns:

A list of scorekeeper slug strings

Return type:

list[str]

retrieve_by_id(scorekeeper_id)

Retrieves scorekeeper information.

Parameters:

scorekeeper_id (int) -- Scorekeeper ID

Returns:

A dictionary containing scorekeeper ID, name, slug string, gender and pronouns

Return type:

dict[str, Any]

retrieve_by_slug(scorekeeper_slug)

Retrieves scorekeeper information.

Parameters:

scorekeeper_slug (str) -- Scorekeeper slug string

Returns:

A dictionary containing scorekeeper ID, name, slug string, gender and pronouns

Return type:

dict[str, Any]

retrieve_details_by_id(scorekeeper_id)

Retrieves scorekeeper information and appearances.

Parameters:

scorekeeper_id (int) -- Scorekeeper ID

Returns:

A dictionaries containing scorekeeper ID, name, slug string, gender, pronouns, whether the scorekeeper is also a guest, host or panelist, and a list of appearances with show flags

Return type:

dict[str, Any]

retrieve_details_by_slug(scorekeeper_slug)

Retrieves scorekeeper information and appearances.

Parameters:

scorekeeper_slug (str) -- Scorekeeper slug string

Returns:

A dictionaries containing scorekeeper ID, name, slug string, gender, pronouns, whether the scorekeeper is also a guest, host or panelist, and a list of appearances with show flags

Return type:

dict[str, Any]

retrieve_random()

Retrieves information for a random scorekeeper.

Returns:

A dictionary containing scorekeeper ID, name, slug string, gender and pronouns

Return type:

dict[str, Any]

retrieve_random_details()

Retrieves information and appearances for a random scorekeeper.

Returns:

A dictionaries containing scorekeeper ID, name, slug string, gender, pronouns, whether the scorekeeper is also a guest, host or panelist, and a list of appearances with show flags

Return type:

dict[str, Any]

retrieve_random_id()

Retrieves an ID for a random scorekeeper.

Returns:

ID for a random scorekeeper.

Return type:

int

retrieve_random_slug()

Retrieves an slug string for a random scorekeeper.

Returns:

Slug string for a random scorekeeper.

Return type:

str

ScorekeeperAppearances

class wwdtm.scorekeeper.ScorekeeperAppearances(connect_dict=None, database_connection=None)

Scorekeeper appearance information retrieval class.

Contains methods used to retrieve scorekeeper appearance information, including show flags.

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(scorekeeper_id)

Retrieves scorekeeper appearance information.

Parameters:

scorekeeper_id (int) -- Scorekeeper ID

Returns:

A dictionary containing scorekeeper appearances with corresponding show dates and Best Of or Repeat show flags

Return type:

dict[str, Any]

retrieve_appearances_by_slug(scorekeeper_slug)

Retrieves scorekeeper appearance information.

Parameters:

scorekeeper_slug (str) -- Scorekeeper slug string

Returns:

A dictionary containing scorekeeper appearances with corresponding show dates and Best Of or Repeat show flags

Return type:

dict[str, Any]

ScorekeeperUtility

class wwdtm.scorekeeper.ScorekeeperUtility(connect_dict=None, database_connection=None)

Scorekeeper information and utilities class.

Contains methods used to convert between scorekeeper ID and slug strings, and to check if scorekeeper 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(scorekeeper_id)

Converts a scorekeeper ID to the corresponding scorekeeper slug string.

Parameters:

scorekeeper_id (int) -- Scorekeeper ID

Returns:

Scorekeeper slug string if a corresponding value is found. Otherwise, None is returned

Return type:

str | None

convert_slug_to_id(scorekeeper_slug)

Converts a scorekeeper slug string to the corresponding scorekeeper ID.

Parameters:

scorekeeper_slug (str) -- Scorekeeper slug string

Returns:

Scorekeeper ID as an integer if a corresponding value is found. Otherwise, None is returned

Return type:

int | None

id_exists(scorekeeper_id)

Validates if a scorekeeper ID exists.

Parameters:

scorekeeper_id (int) -- Scorekeeper ID

Returns:

True if the ID exists, otherwise False

Return type:

bool

slug_exists(scorekeeper_slug)

Validates if a scorekeeper slug string exists.

Parameters:

scorekeeper_slug (str) -- Scorekeeper slug string

Returns:

True if the slug string exists, otherwise False

Return type:

bool