Module: show
This module provides objects used to retrieve shows, show information,
and show details from a copy of the Wait Wait Don’t Tell Me! Stats
database.
Contents
Show
class wwdtm.show. Show ( connect_dict = None , database_connection = None )
Show retrieval class.
Contains methods used to retrieve basic and detailed show
information, including hosts, scorekeepers, guests, panelists 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 basic show information for all shows.
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable) and show
URL at NPR.org
Return type:
list [dict [str , Any ]]
retrieve_all_dates ( )
Retrieves all show dates, sorted by show date.
Returns:
A list of all show date strings in YYYY-MM-DD
format
Return type:
list [str ]
retrieve_all_dates_tuple ( )
Retrieves all show dates as a tuple.
Returns:
A list of all show dates as a tuple of year, month and
day
Return type:
list [tuple [int , int , int ]]
retrieve_all_details ( include_decimal_scores = False )
Retrieves detailed show information for all shows.
Parameters:
include_decimal_scores (bool ) – A boolean to determine if decimal
scores should be used and returned instead of integer scores
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable), show URL
at NPR.org, host, scorekeeper, location, panelists and
guests
Return type:
list [dict [str , Any ]]
retrieve_all_ids ( )
Retrieves all show IDs, sorted by show date.
Returns:
A list of all show IDs as integers
Return type:
list [int ]
retrieve_all_show_years_months ( )
Retrieves all show years and months.
Returns:
A list of all show years and month as a string in
YYYY-MM format
Return type:
list [str ]
retrieve_all_shows_years_months_tuple ( )
Retrieves all show years and months as a tuple.
Returns:
A list of all show dates as a tuple of year and month
Return type:
list [tuple [int , int ]]
retrieve_by_date ( year , month , day )
Retrieves basic show information.
Parameters:
year (int ) – Four-digit year
month (int ) – One or two-digit month
day (int ) – One or two-digit day
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable) and show URL at
NPR.org
Return type:
dict [str , Any ]
retrieve_by_date_string ( date_string )
Retrieves basic show information.
Parameters:
date_string (str ) – Show date in YYYY-MM-DD format
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable) and show URL at
NPR.org
Return type:
dict [str , Any ]
retrieve_by_id ( show_id )
Retrieves basic show information.
Parameters:
show_id (int ) – Show ID
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable) and show URL at
NPR.org
Return type:
dict [str , Any ]
retrieve_by_month_day ( month , day )
Retrieves basic show information for shows by month and day.
Parameters:
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable) and show
URL at NPR.org
Return type:
list [dict [str , Any ]]
retrieve_by_year ( year )
Retrieves basic show information by year.
Parameters:
year (int ) – Four-digit year
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable) and show
URL at NPR.org
Return type:
list [dict [str , Any ]]
retrieve_by_year_month ( year , month )
Retrieves basic show information by year and month.
Parameters:
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable) and show
URL at NPR.org
Return type:
list [dict [str , Any ]]
retrieve_details_by_date ( year , month , day , include_decimal_scores = False )
Retrieves detailed show information.
Parameters:
year (int ) – Four-digit year
month (int ) – One or two-digit month
day (int ) – One or two digit day
include_decimal_scores (bool ) – A boolean to determine if decimal
scores should be included
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable), show URL at
NPR.org, host, scorekeeper, location, panelists and guests
Return type:
dict [str , Any ]
retrieve_details_by_date_string ( date_string , include_decimal_scores = False )
Retrieves detailed show information.
Parameters:
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable), show URL at
NPR.org, host, scorekeeper, location, panelists and guests
Return type:
dict [str , Any ]
retrieve_details_by_id ( show_id , include_decimal_scores = False )
Retrieve detailed show information.
Parameters:
Returns:
A dictionary containing show ID, show date, Best Of
show flag, repeat show ID (if applicable), show URL at
NPR.org, host, scorekeeper, location, panelists and guests
Return type:
dict [str , Any ]
retrieve_details_by_month_day ( month , day , include_decimal_scores = False )
Retrieves detailed show information by month and day.
Parameters:
month (int ) – One or two-digit month
day (int ) – One or two-digit day
include_decimal_scores (bool ) – A boolean to determine if decimal
scores should be included
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable), show URL
at NPR.org, host, scorekeeper, location, panelists and
guests
Return type:
list [dict [str , Any ]]
retrieve_details_by_year ( year , include_decimal_scores = False )
Retrieves detailed show information by year.
Parameters:
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable), show URL
at NPR.org, host, scorekeeper, location, panelists and
guests
Return type:
list [dict [str , Any ]]
retrieve_details_by_year_month ( year , month , include_decimal_scores = False )
Retrieves detailed show information by year and month.
Parameters:
year (int ) – Four-digit year
month (int ) – One or two-digit month
include_decimal_scores (bool ) – A boolean to determine if decimal
scores should be included
Returns:
A list of dictionaries containing show ID, show date,
Best Of show flag, repeat show ID (if applicable), show URL
at NPR.org, host, scorekeeper, location, panelists and
guests
Return type:
list [dict [str , Any ]]
retrieve_months_by_year ( year )
Retrieves show months for a year.
Parameters:
year (int ) – Four-digit year
Returns:
A list of available show months
Return type:
list [int ]
retrieve_recent ( include_days_ahead = 7 , include_days_back = 32 )
Retrieves basic show information for recent shows.
Parameters:
Returns:
List of recent shows and corresponding information. If
show information could not be retrieved, an empty list will
be returned.
Return type:
list [dict [str , Any ]]
retrieve_recent_details ( include_days_ahead = 7 , include_days_back = 32 , include_decimal_scores = False )
Retrieves detailed show information for recent shows.
Parameters:
include_days_ahead (int ) – Number of days in the future to
include
include_days_back (int ) – Number of days in the past to
include
include_decimal_scores (bool ) – A boolean to determine if decimal
scores should be included
Returns:
List of recent shows and corresponding details. If show
information could not be retrieved, an empty list will be
returned.
Return type:
list [dict [str , Any ]]
retrieve_scores_by_year ( year , use_decimal_scores = False )
Retrieves panelist scores for all shows as a tuple.
Parameters:
Returns:
A list of tuples each containing show date and panelist
scores
Return type:
list [tuple [str , int | Decimal ]]
retrieve_years ( )
Retrieves show years.
Returns:
A list of available show years
Return type:
list [int ]
ShowInfo
class wwdtm.show. ShowInfo ( connect_dict = None , database_connection = None )
Show information retrieval class.
Contains methods used to retrieve panelist, guest and Bluff the
Listener information.
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_bluff_info_by_id ( show_id )
Retrieves Bluff the Listener information.
Parameters:
show_id (int ) – Show ID
Returns:
A dictionary containing Bluff the Listener segment ID
and information about the chosen Bluff panelist and correct
Bluff panelist.
Return type:
list [dict [str , Any ]]
retrieve_core_info_by_id ( show_id )
Retrieves core information.
Parameters:
show_id (int ) – Show ID
Returns:
A dictionary containing host, scorekeeper, location,
description and notes
Return type:
dict [str , Any ]
retrieve_guest_info_by_id ( show_id )
Retrieves Not My Job guest information.
Parameters:
show_id (int ) – Show ID
Returns:
A dictionary containing Not My Job guest information,
including score and scoring exception for each guest
Return type:
list [dict [str , Any ]]
retrieve_panelist_info_by_id ( show_id , include_decimal_scores = False )
Retrieves panelist information.
Parameters:
Returns:
A dictionary containing panelist information, scores
and rankings
Return type:
list [dict [str , Any ]]
ShowInfoMultiple
class wwdtm.show. ShowInfoMultiple ( connect_dict = None , database_connection = None )
Multiple show information retrieval class.
Contains methods used to retrieve panelist, guest and Bluff the
Listener information for multiple shows.
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_bluff_info_all ( )
Retrieves Bluff the Listener information for all shows.
Returns:
A dictionary containing Bluff the Listener segment ID
and information about the chosen Bluff panelist and correct
Bluff panelist.
Return type:
dict [int , list [dict [str , Any ]]]
retrieve_bluff_info_by_ids ( show_ids )
Retrieves Bluff the Listener information for a list of shows.
Parameters:
Returns:
A dictionary containing Bluff the Listener segment ID
and information about the chosen Bluff panelist and correct
Bluff panelist.
Return type:
dict [int , list [dict [str , Any ]]]
retrieve_core_info_all ( )
Retrieves core information for all shows.
Returns:
A dictionary containing host, scorekeeper, location,
description and notes
Return type:
dict [int , dict [str , Any ]]
retrieve_core_info_by_ids ( show_ids )
Retrieves core information for a list of shows.
Parameters:
show_ids (list [ int ] ) – A list of show IDs
Returns:
A dictionary containing host, scorekeeper, location,
description and notes
Return type:
dict [int , dict [str , Any ]]
retrieve_guest_info_all ( )
Retrieves Not My Job guest information for all shows.
Returns:
A dictionary containing Not My Job guest information,
including score and scoring exception for each guest
Return type:
dict [int , list [dict [str , Any ]]]
retrieve_guest_info_by_ids ( show_ids )
Retrieves Not My Job guest information for all shows.
Parameters:
show_ids (list [ int ] ) – A list of show IDs
Returns:
A dictionary containing Not My Job guest information,
including score and scoring exception for each guest.
Return type:
dict [int , list [dict [str , Any ]]]
retrieve_panelist_info_all ( include_decimal_scores = False )
Retrieves panelist information for all shows.
Parameters:
Returns:
A dictionary containing panelist information, scores
and rankings
Return type:
dict [int , list [dict [str , Any ]]]
retrieve_panelist_info_by_ids ( show_ids , include_decimal_scores = False )
Retrieves panelist information for a list of shows.
Parameters:
show_ids (list [ int ] ) – A list of show IDs
use_decimal_scores – A boolean to determine if decimal
scores should be used and returned instead of integer scores
include_decimal_scores (bool ) –
Returns:
A dictionary containing panelist information, scores
and rankings
Return type:
dict [int , list [dict [str , Any ]]]
ShowUtility
class wwdtm.show. ShowUtility ( connect_dict = None , database_connection = None )
Show information and utility class.
Contains methods to convert between show ID and date, and to check
if show IDs and dates 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_date_to_id ( year , month , day )
Converts a show date to the corresponding show ID.
Parameters:
year (int ) – Year portion of a show date
month (int ) – Month portion of a show date
day (int ) – Day portion of a show date
Returns:
Show ID if a corresponding value is found. Otherwise,
None is returned
Return type:
int | None
convert_id_to_date ( show_id )
Converts a show ID to the corresponding show date.
Parameters:
show_id (int ) – Show ID
Returns:
Show date if a corresponding value is found. Otherwise,
None is returned
Return type:
str | None
date_exists ( year , month , day )
Validates if a show date exists.
Parameters:
year (int ) – Year portion of a show date
month (int ) – Month portion of a show date
day (int ) – Day portion of a show date
Returns:
True if the show date exists, otherwise False
Return type:
bool
id_exists ( show_id )
Validates if a show ID exists.
Parameters:
show_id (int ) – Show ID
Returns:
True if the show ID exists, otherwise False
Return type:
bool