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.
Show
-
class wwdtm.show.Show(connect_dict=None, database_connection=None)
This class contains functions used to retrieve show 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 show ID,
show date, Best Of and Repeat Show information for all shows.
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of all shows and their corresponding information.
If show information could not be retrieved, an empty list
will be returned.
-
retrieve_all_dates()
Returns a list of all show dates from the database, sorted
by show date.
- Return type:
List
[str
]
- Returns:
List of all show date strings. If show dates could not
be retrieved, an empty list will be returned.
-
retrieve_all_dates_tuple()
Returns a list of all show dates as a tuple of year, month,
and day, sorted by show date.
- Return type:
List
[Tuple
[int
, int
, int
]]
- Returns:
List of allow show dates as a tuple of year, month
and day. If show dates could not be retrieved, an empty list
will be returned.
-
retrieve_all_details()
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for all shows.
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of all shows and their corresponding details.
If show information could not be retrieved, an empty list
will be returned.
-
retrieve_all_ids()
Returns a list of all show IDs from the database, sorted by
show date.
- Return type:
List
[int
]
- Returns:
List of all show IDs. If show IDs could not be
retrieved, an empty list will be returned.
-
retrieve_all_show_years_months()
Returns a list of all show years and months as a string,
sorted by year and month.
- Return type:
List
[str
]
- Returns:
List of all show years and month in YYYY-MM
format.
If show dates could not be retrieved, an empty list will be
returned.
-
retrieve_all_shows_years_months_tuple()
Returns a list of all show years and months as a tuple of
year and month, sorted by year and month.
- Return type:
List
[Tuple
[int
, int
]]
- Returns:
List of allow show dates as a tuple of year and month.
If show dates could not be retrieved, an empty list will be
returned.
-
retrieve_by_date(year, month, day)
Returns a dictionary object containing show ID, show date,
Best Of and Repeat Show information for the requested show date.
- Parameters:
year (int
) – Four-digit year
month (int
) – One or two-digit month
day (int
) – One or two-digit day
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information. If show
information could not be retrieved, an empty dictionary will
be returned.
-
retrieve_by_date_string(date_string)
Returns a dictionary object containing show ID, show date,
Best Of and Repeat Show information for the requested show date
string.
- Parameters:
date_string (str
) – Show date in YYYY-MM-DD
format
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information. If show
information could not be retrieved, an empty dictionary will
be returned.
-
retrieve_by_id(show_id)
Returns a dictionary object containing show ID, show date,
Best Of and Repeat Show information for the requested show ID.
- Parameters:
show_id (int
) – Show ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information. If show
information could not be retrieved, an empty dictionary will
be returned.
-
retrieve_by_month_day(month, day)
Returns a list of dictionary objects containing with show
information for the requested month and day, sorted by year.
- Parameters:
-
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of shows for the requested month, day, and
corresponding information. If show information could not be
retrieved, an empty list will be returned.
-
retrieve_by_year(year)
Returns a list of dictionary objects containing with show
information for the requested year, sorted by show date.
- Parameters:
year (int
) – Four-digit year
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of shows for the requested year and corresponding
information. If show information could not be retrieved,
an empty list will be returned.
-
retrieve_by_year_month(year, month)
Returns a list of dictionary objects containing show
information for the requested year and month, sorted by show
date.
- Parameters:
-
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of shows for the requested year and month, and
corresponding information. If show information could not be
retrieved, a list of dictionaries will be returned.
-
retrieve_details_by_date(year, month, day)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for the requested show date.
- Parameters:
year (int
) – Four-digit year
month (int
) – One or two-digit month
day (int
) – One or two digit day
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information and details. If
show information could not be retrieved, an empty dictionary
will be returned.
-
retrieve_details_by_date_string(date_string)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for the requested show date string.
- Parameters:
date_string (str
) – Show date in YYYY-MM-DD
format
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information and details. If
show information could not be retrieved, an empty dictionary
will be returned.
-
retrieve_details_by_id(show_id)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for the requested show ID.
- Parameters:
show_id (int
) – Show ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing show information and details. If
show information could not be retrieved, an empty dictionary
will be returned.
-
retrieve_details_by_month_day(month, day)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for the requested month and day, sorted by year.
- Parameters:
-
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
Dictionary containing show information and details. If
show information could not be retrieved, an empty dictionary
will be returned.
-
retrieve_details_by_year(year)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information for
the requested year, sorted by show date.
- Parameters:
year (int
) – Four-digit year
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of shows for the requested year and corresponding
details. If show information could not be retrieved, an
empty list will be returned.
-
retrieve_details_by_year_month(year, month)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information for
the requested year and month, sorted by show date.
- Parameters:
-
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of shows for the requested year and month, and
corresponding details. If show information could not be
retrieved, an empty list will be returned.
-
retrieve_months_by_year(year)
Returns a list of show months available for the requested
year, sorted by month.
- Parameters:
year (int
) – Four-digit year
- Return type:
List
[int
]
- Returns:
List of available show months. If show information
could not be retrieved, an empty list will be returned.
-
retrieve_recent(include_days_ahead=7, include_days_back=32)
Returns a list of dictionary objects containing show ID,
show date, Best Of and Repeat Show information for recent shows.
- Parameters:
include_days_ahead (Optional
[int
]) – Number of days in the future to
include, defaults to 7
include_days_back (Optional
[int
]) – Number of days in the past to
include, defaults to 32
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of recent shows and corresponding information. If
show information could not be retrieved, an empty list will
be returned.
-
retrieve_recent_details(include_days_ahead=7, include_days_back=32)
Returns a list of dictionary objects containing show ID,
show date, host, scorekeeper, panelist and guest information
for recent shows.
- Parameters:
include_days_ahead (Optional
[int
]) – Number of days in the future to
include, defaults to 7
include_days_back (Optional
[int
]) – Number of days in the past to
include, defaults to 32
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of recent shows and corresponding details. If show
information could not be retrieved, an empty list will be
returned.
-
retrieve_scores_by_year(year)
Returns a list of tuples containing panelist scores for all
shows in the requested year, sorted by show date.
- Parameters:
year (int
) – Four-digit year
- Return type:
List
[Tuple
]
- Returns:
List of tuples each containing show date and panelist
scores. If show scores could not be retrieved, an empty list
will be returned.
-
retrieve_years()
Returns a list of available show years, sorted by year.
- Return type:
List
[int
]
- Returns:
List of available show years. If show dates could not
be retrieved, an empty list will be returned.
ShowInfo
-
class wwdtm.show.ShowInfo(connect_dict=None, database_connection=None)
This class contains functions that retrieve show supplemental
show information, including panelist, guest and Bluff the Listener
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_bluff_info_by_id(show_id)
Returns a dictionary containing Bluff the Listener information
for the requested show ID.
- Parameters:
show_id (int
) – Show ID
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing correct and chosen Bluff the
Listener information.
-
retrieve_core_info_by_id(show_id)
Returns a dictionary with core information for the requested
show ID.
- Parameters:
-
- Return type:
Dict
[str
, Any
]
- Returns:
Dictionary containing host, scorekeeper, location,
description and notes. If show core information could not be
retrieved, an empty dictionary will be returned.
-
retrieve_guest_info_by_id(show_id)
Returns a list of dictionary objects containing Not My Job
guest information for the requested show ID.
- Parameters:
show_id (int
) – Show ID
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
Dictionary containing Not My Job guest information. If
Not My Job information could not be retrieved, an empty list
will be returned.
-
retrieve_panelist_info_by_id(show_id)
Returns a list of dictionary objects containing panelist
information for the requested show ID.
- Parameters:
show_id (int
) – Show ID
- Return type:
List
[Dict
[str
, Any
]]
- Returns:
List of panelists with corresponding scores and
ranking information. If panelist information could not be
retrieved, an empty list will be returned.
ShowInfoMultiple
-
class wwdtm.show.ShowInfoMultiple(connect_dict=None, database_connection=None)
This class contains functions that retrieve show supplemental
show information, including panelist, guest and Bluff the Listener
information for multiple shows 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_bluff_info_all()
Returns a dictionary containing Bluff the Listener information
for all shows.
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
Dictionary containing correct and chosen Bluff the
Listener information.
-
retrieve_bluff_info_by_ids(show_ids)
Returns a dictionary containing Bluff the Listener information
for the requested show IDs.
- Parameters:
show_ids (List
[int
]) – List of show IDs
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
Dictionary containing correct and chosen Bluff the
Listener information.
-
retrieve_core_info_all()
Returns a dictionary with core information for all shows.
- Return type:
Dict
[int
, Dict
[str
, Any
]]
- Returns:
Dictionary containing host, scorekeeper, location,
description and notes. If show core information could not be
retrieved, an empty dictionary will be returned.
-
retrieve_core_info_by_ids(show_ids)
Returns a dictionary with core information for the requested
show IDs.
- Parameters:
show_ids (List
[int
]) – List of show IDs
- Return type:
Dict
[int
, Dict
[str
, Any
]]
- Returns:
Dictionary containing host, scorekeeper, location,
description and notes. If show core information could not be
retrieved, an empty dictionary will be returned.
-
retrieve_guest_info_all()
Returns a list of dictionary objects containing Not My Job
guest information for all shows.
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
Dictionary containing Not My Job guest information. If
Not My Job information could not be retrieved, an empty list
will be returned.
-
retrieve_guest_info_by_ids(show_ids)
Returns a list of dictionary objects containing Not My Job
guest information for the requested show IDs.
- Parameters:
show_ids (List
[int
]) – List of show IDs
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
Dictionary containing Not My Job guest information. If
Not My Job information could not be retrieved, an empty list
will be returned.
-
retrieve_panelist_info_all()
Returns a list of dictionary objects containing panelist
information for all shows.
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
List of panelists with corresponding scores and
ranking information. If panelist information could not be
retrieved, an empty list will be returned.
-
retrieve_panelist_info_by_ids(show_ids)
Returns a list of dictionary objects containing panelist
information for the requested show IDs.
- Parameters:
show_ids (List
[int
]) – List of show IDs
- Return type:
Dict
[int
, List
[Dict
[str
, Any
]]]
- Returns:
List of panelists with corresponding scores and
ranking information. If panelist information could not be
retrieved, an empty list will be returned.
ShowUtility
-
class wwdtm.show.ShowUtility(connect_dict=None, database_connection=None)
This class contains supporting functions used to check whether
a show ID or show date exists or to convert between show ID, and
show dates.
- 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_date_to_id(year, month, day)
Converts a show date to the matching show ID value.
- 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
- Return type:
Optional
[int
]
- Returns:
Show ID, if a match is found
-
convert_id_to_date(show_id)
Converts a show’s ID to the matching show date.
- Parameters:
show_id (int
) – Show ID
- Return type:
Optional
[str
]
- Returns:
Show date, if a match is found
-
date_exists(year, month, day)
Checks to see 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
- Return type:
bool
- Returns:
True or False, based on whether the show date exists
-
id_exists(show_id)
Checks to see if a show ID exists.
- Parameters:
show_id (int
) – Show ID
- Return type:
bool
- Returns:
True or False, based on whether the show ID exists