Standings
Standings Class Documentation
Represents the standings for a racing league, including athletes, manufacturers, and performance records.
This class initializes and processes standings data from a given JSON structure, fetching additional details for athletes and manufacturers via the ESPN API.
Attributes:
Name | Type | Description |
---|---|---|
standings_json |
dict
|
Raw JSON data containing the standings structure. |
espn_instance |
object
|
An instance of the ESPN API handler (PyESPN). |
standings |
list
|
A list of dictionaries, each containing: - 'athlete' (Player or None): The athlete in the standing. - 'manufacturer' (Manufacturer or None): The associated manufacturer. - 'record' (list of Record): A list of performance records. |
standings_type_name |
str
|
The display name for the standings category (e.g., "Drivers", "Constructors"). |
this_athlete |
Player or None
|
Temporary reference to the currently processed athlete. |
this_manufacturer |
Manufacturer or None
|
Temporary reference to the currently processed manufacturer. |
Methods:
Name | Description |
---|---|
__repr__ |
Returns a string representation of the standings. |
_load_standings_data |
Parses JSON and populates the standings with athletes, manufacturers, and records. |
Source code in pyespn/classes/standings.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(standings_json, espn_instance)
Initializes the Standings instance and loads standings data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
standings_json
|
dict
|
The JSON data containing standings information. |
required |
espn_instance
|
object
|
An instance of the ESPN API handler. |
required |
Source code in pyespn/classes/standings.py
__repr__()
Returns a string representation of the Standings instance.
The representation includes the standings type and the number of entries in the standings list.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A formatted string representing the standings. |
Source code in pyespn/classes/standings.py
to_dict()
Converts the Standings instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The standings's raw JSON data. |