Leader Category
Leader Category Class
Represents a category of statistical leaders for a given season.
The LeaderCategory class is responsible for storing and managing information about a specific leader category, such as the category's name, abbreviation, and the athletes who are the statistical leaders in that category for the specified season. The data is loaded from a given JSON object, and the class provides methods to represent and interact with this data.
Attributes:
Name | Type | Description |
---|---|---|
leader_cat_json |
dict
|
The JSON data containing information about the leader category. |
espn_instance |
object
|
The instance of the ESPN-related class for interacting with ESPN data. |
athletes |
dict
|
A dictionary holding athletes (as instances of the Leader class) for each season. |
season |
str or int
|
The season for which the leader category data is relevant. |
abbreviation |
str
|
The abbreviation of the leader category. |
name |
str
|
The name of the leader category. |
display_name |
str
|
The display name of the leader category. |
Methods:
Name | Description |
---|---|
__repr__ |
Returns a string representation of the LeaderCategory instance. |
_load_leaders_data |
Loads the leader data from the provided JSON and initializes the class attributes. |
Source code in pyespn/classes/stat.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(leader_cat_json, espn_instance, season)
Initializes a LeaderCategory instance with the given data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
leader_cat_json
|
dict
|
The JSON data for the leader category. |
required |
espn_instance
|
object
|
An instance of the ESPN class for interacting with ESPN data. |
required |
season
|
str or int
|
The season the leader category is related to. |
required |
Source code in pyespn/classes/stat.py
__repr__()
Returns a string representation of the Leader Category instance.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A formatted string with the leader info. |
to_dict()
Converts the LeaderCategory instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The leader category's raw JSON data. |