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)
This class contains functions used to retrieve scorekeeper data
from a copy of the Wait Wait Stats database.
- Parameters:
connect_dict (Optional
[Dict
[str
, Any
]]) – Dictionary containing database connection
settings as required by mysql.connector.connect
database_connection (Optional
[connect
]) – mysql.connector.connect database
connection
-
retrieve_all()
Returns a list of dictionary objects containing scorekeeper
ID, name and slug string for all scorekeepers.
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of all scorekeepers and their corresponding
information. If scorekeeper information could not be
retrieved, an empty list will be returned.
-
retrieve_all_details()
Returns a list of dictionary objects containing scorekeeper
ID, name, slug string and appearance information for all
scorekeepers.
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of all scorekeepers and their corresponding
information and appearances. If scorekeeper information
could not be retrieved, an empty list will be returned.
-
retrieve_all_ids()
Returns a list of all scorekeeper IDs from the database,
sorted by scorekeeper name.
- Return type:
List
[int
]
- Returns:
List of all scorekeeper IDs. If scorekeeper IDs could
not be retrieved, an empty list would be returned.
-
retrieve_all_slugs()
Returns a list of all scorekeeper slug strings from the
database, sorted by scorekeeper name.
- Return type:
List
[str
]
- Returns:
List of all scorekeeper slug strings. If scorekeeper
slug strings could not be retrieved, an empty list will be
returned.
-
retrieve_by_id(scorekeeper_id)
Returns a dictionary object containing scorekeeper ID, name
and slug string for the requested scorekeeper ID.
- Parameters:
scorekeeper_id (int
) – Scorekeeper ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing scorekeeper information. If
scorekeeper information could not be retrieved, an empty
dictionary will be returned.
-
retrieve_by_slug(scorekeeper_slug)
Returns a dictionary object containing scorekeeper ID, name
and slug string for the requested scorekeeper slug string.
- Parameters:
scorekeeper_slug (str
) – Scorekeeper slug string
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing scorekeeper information. If
scorekeeper information could not be retrieved, an empty
dictionary will be returned.
-
retrieve_details_by_id(scorekeeper_id)
Returns a dictionary object containing scorekeeper ID, name,
slug string and appearance information for the requested
scorekeeper ID.
- Parameters:
scorekeeper_id (int
) – Scorekeeper ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing scorekeeper information and
their appearances. If scorekeeper information could not be
retrieved, an empty dictionary will be returned.
-
retrieve_details_by_slug(scorekeeper_slug)
Returns a dictionary object containing scorekeeper ID, name,
slug string and appearance information for the requested
scorekeeper slug string.
- Parameters:
scorekeeper_slug (str
) – Scorekeeper slug string
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing scorekeeper information and
their appearances. If scorekeeper information could not be
retrieved, an empty dictionary will be returned.
ScorekeeperAppearances
-
class wwdtm.scorekeeper.ScorekeeperAppearances(connect_dict=None, database_connection=None)
This class contains functions that retrieve scorekeeper
appearance information from a copy of the Wait Wait Stats database.
- Parameters:
connect_dict (Optional
[Dict
[str
, Any
]]) – Dictionary containing database connection
settings as required by mysql.connector.connect
database_connection (Optional
[connect
]) – mysql.connector.connect database
connection
-
retrieve_appearances_by_id(scorekeeper_id)
Returns a list of dictionary objects containing appearance
information for the requested scorekeeper ID.
- Parameters:
scorekeeper_id (int
) – Scorekeeper ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing appearance counts and list of
appearances for a scorekeeper. If scorekeeper appearances
could not be retrieved, an empty dictionary would be
returned.
-
retrieve_appearances_by_slug(scorekeeper_slug)
Returns a list of dictionary objects containing appearance
information for the requested scorekeeper ID.
- Parameters:
scorekeeper_slug (str
) – Scorekeeper slug string
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing appearance counts and list of
appearances for a scorekeeper. If scorekeeper appearances
could not be retrieved, an empty dictionary would be
returned.
ScorekeeperUtility
-
class wwdtm.scorekeeper.ScorekeeperUtility(connect_dict=None, database_connection=None)
This class contains supporting functions used to check whether
a scorekeeper ID or slug string exists or to convert an ID to a slug
string, or vice versa.
- Parameters:
connect_dict (Optional
[Dict
[str
, Any
]]) – Dictionary containing database connection
settings as required by mysql.connector.connect
database_connection (Optional
[connect
]) – mysql.connector.connect database
connection
-
convert_id_to_slug(scorekeeper_id)
Converts a scorekeeper’s ID to the matching scorekeeper slug
string value.
- Parameters:
scorekeeper_id (int
) – Scorekeeper ID
- Return type:
Optional
[str
]
- Returns:
Scorekeeper slug string, if a match is found
-
convert_slug_to_id(scorekeeper_slug)
Converts a scorekeeper’s slug string to the matching
scorekeeper ID value.
- Parameters:
scorekeeper_slug (str
) – Scorekeeper slug string
- Return type:
Optional
[int
]
- Returns:
Scorekeeper ID, if a match is found
-
id_exists(scorekeeper_id)
Checks to see if a scorekeeper ID exists.
- Parameters:
scorekeeper_id (int
) – Scorekeeper ID
- Return type:
bool
- Returns:
True or False, based on whether the scorekeeper ID
exists
-
slug_exists(scorekeeper_slug)
Checks to see if a scorekeeper slug string exists.
- Parameters:
scorekeeper_slug (str
) – Scorekeeper slug string
- Return type:
bool
- Returns:
True or False, based on whether the scorekeeper slug
string exists