yfpy.models.Matchup

class Matchup(extracted_data)[source]

Bases: yfpy.models.YahooFantasyObject

Model class for “matchup” data key.

Instantiate the Matchup child class of YahooFantasyObject.

Parameters

extracted_data (dict) – Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

is_consolation

Numeric boolean (0 or 1) representing if the matchup is in a consolation bracket.

Type

int

is_matchup_recap_available

Numeric boolean (0 or 1) representing if the matchup recap is available.

Type

int

is_playoffs

Numeric boolean (0 or 1) representing if the matchup is in the playoffs bracket.

Type

int

is_tied

Numeric boolean (0 or 1) representing if the matchup result is tied.

Type

int

matchup_grades

A list of YFPY MatchupGrade instances.

Type

list[MatchupGrade]

matchup_recap_title

The title of the matchup recap.

Type

str

matchup_recap_url

The direct URL of the matchup recap.

Type

str

status

The status of the matchup (“postevent”, etc.).

Type

str

teams

A list of YFPY Team instances for teams in the matchup.

Type

list[Team]

week

The week number of the matchup.

Type

int

week_end

A date string representing the end of the matchup week (format: “YYYY-MM-DD”).

Type

str

week_start

A date string representing the start of the matchup week (format: “YYYY-MM-DD”).

Type

str

winner_team_key

The Yahoo team key of the team that won the matchup.

Type

str

Methods

clean_data_dict

Recursive method to un-type custom class type objects for serialization.

from_json

Deserialize JSON to a class object.

serialized

Pack up all object content into nested dictionaries for JSON serialization.

subclass_dict

Derive snake case dictionary keys from custom object type camel case class names.

to_json

Serialize the class object to JSON.

clean_data_dict()

Recursive method to un-type custom class type objects for serialization.

Returns

Dictionary that extracts serializable data from custom objects.

Return type

dict

classmethod from_json(json_data)

Deserialize JSON to a class object.

Returns

Class object derived from JSON data.

Return type

object

serialized()

Pack up all object content into nested dictionaries for JSON serialization.

Returns

Serializable dictionary.

Return type

dict

subclass_dict()

Derive snake case dictionary keys from custom object type camel case class names.

Returns

Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as values.

Return type

dict

to_json()

Serialize the class object to JSON.

Returns

JSON string derived from the serializable version of the class object.

Return type

str