cbbd 1.1.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. cbbd/__init__.py +64 -0
  2. cbbd/api/__init__.py +10 -0
  3. cbbd/api/conferences_api.py +176 -0
  4. cbbd/api/games_api.py +806 -0
  5. cbbd/api/plays_api.py +761 -0
  6. cbbd/api/stats_api.py +423 -0
  7. cbbd/api/teams_api.py +195 -0
  8. cbbd/api/venues_api.py +176 -0
  9. cbbd/api_client.py +767 -0
  10. cbbd/api_response.py +25 -0
  11. cbbd/configuration.py +443 -0
  12. cbbd/exceptions.py +167 -0
  13. cbbd/models/__init__.py +42 -0
  14. cbbd/models/conference_info.py +80 -0
  15. cbbd/models/game_box_score_players.py +147 -0
  16. cbbd/models/game_box_score_players_players_inner.py +238 -0
  17. cbbd/models/game_box_score_team.py +148 -0
  18. cbbd/models/game_box_score_team_stats.py +170 -0
  19. cbbd/models/game_box_score_team_stats_points.py +112 -0
  20. cbbd/models/game_info.py +212 -0
  21. cbbd/models/game_media_info.py +133 -0
  22. cbbd/models/game_media_info_broadcasts_inner.py +74 -0
  23. cbbd/models/game_status.py +44 -0
  24. cbbd/models/play_info.py +193 -0
  25. cbbd/models/play_info_participants_inner.py +74 -0
  26. cbbd/models/play_type_info.py +74 -0
  27. cbbd/models/player_season_stats.py +231 -0
  28. cbbd/models/season_type.py +42 -0
  29. cbbd/models/team_info.py +160 -0
  30. cbbd/models/team_season_stats.py +112 -0
  31. cbbd/models/team_season_unit_stats.py +163 -0
  32. cbbd/models/team_season_unit_stats_field_goals.py +91 -0
  33. cbbd/models/team_season_unit_stats_fouls.py +91 -0
  34. cbbd/models/team_season_unit_stats_four_factors.py +98 -0
  35. cbbd/models/team_season_unit_stats_points.py +98 -0
  36. cbbd/models/team_season_unit_stats_rebounds.py +91 -0
  37. cbbd/models/team_season_unit_stats_turnovers.py +84 -0
  38. cbbd/models/venue_info.py +102 -0
  39. cbbd/py.typed +0 -0
  40. cbbd/rest.py +330 -0
  41. cbbd-1.1.0a1.dist-info/METADATA +24 -0
  42. cbbd-1.1.0a1.dist-info/RECORD +44 -0
  43. cbbd-1.1.0a1.dist-info/WHEEL +5 -0
  44. cbbd-1.1.0a1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,231 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ College Basketball Data API
5
+
6
+ This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Contact: admin@collegefootballdata.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+
22
+ from typing import Optional, Union
23
+ from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr
24
+ from cbbd.models.team_season_unit_stats_field_goals import TeamSeasonUnitStatsFieldGoals
25
+ from cbbd.models.team_season_unit_stats_rebounds import TeamSeasonUnitStatsRebounds
26
+
27
+ class PlayerSeasonStats(BaseModel):
28
+ """
29
+ PlayerSeasonStats
30
+ """
31
+ season: StrictInt = Field(...)
32
+ season_label: StrictStr = Field(default=..., alias="seasonLabel")
33
+ team_id: StrictInt = Field(default=..., alias="teamId")
34
+ team: StrictStr = Field(...)
35
+ conference: Optional[StrictStr] = Field(...)
36
+ athlete_id: StrictInt = Field(default=..., alias="athleteId")
37
+ athlete_source_id: StrictStr = Field(default=..., alias="athleteSourceId")
38
+ name: StrictStr = Field(...)
39
+ position: StrictStr = Field(...)
40
+ games: Union[StrictFloat, StrictInt] = Field(...)
41
+ starts: Union[StrictFloat, StrictInt] = Field(...)
42
+ minutes: Union[StrictFloat, StrictInt] = Field(...)
43
+ points: Optional[Union[StrictFloat, StrictInt]] = Field(...)
44
+ turnovers: Optional[Union[StrictFloat, StrictInt]] = Field(...)
45
+ fouls: Optional[Union[StrictFloat, StrictInt]] = Field(...)
46
+ assists: Optional[Union[StrictFloat, StrictInt]] = Field(...)
47
+ steals: Optional[Union[StrictFloat, StrictInt]] = Field(...)
48
+ blocks: Optional[Union[StrictFloat, StrictInt]] = Field(...)
49
+ usage: Optional[Union[StrictFloat, StrictInt]] = Field(...)
50
+ offensive_rating: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="offensiveRating")
51
+ defensive_rating: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="defensiveRating")
52
+ net_rating: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="netRating")
53
+ effective_field_goal_pct: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="effectiveFieldGoalPct")
54
+ true_shooting_pct: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="trueShootingPct")
55
+ assists_turnover_ratio: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="assistsTurnoverRatio")
56
+ free_throw_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="freeThrowRate")
57
+ offensive_rebound_pct: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="offensiveReboundPct")
58
+ field_goals: TeamSeasonUnitStatsFieldGoals = Field(default=..., alias="fieldGoals")
59
+ two_point_field_goals: TeamSeasonUnitStatsFieldGoals = Field(default=..., alias="twoPointFieldGoals")
60
+ three_point_field_goals: TeamSeasonUnitStatsFieldGoals = Field(default=..., alias="threePointFieldGoals")
61
+ free_throws: TeamSeasonUnitStatsFieldGoals = Field(default=..., alias="freeThrows")
62
+ rebounds: TeamSeasonUnitStatsRebounds = Field(...)
63
+ __properties = ["season", "seasonLabel", "teamId", "team", "conference", "athleteId", "athleteSourceId", "name", "position", "games", "starts", "minutes", "points", "turnovers", "fouls", "assists", "steals", "blocks", "usage", "offensiveRating", "defensiveRating", "netRating", "effectiveFieldGoalPct", "trueShootingPct", "assistsTurnoverRatio", "freeThrowRate", "offensiveReboundPct", "fieldGoals", "twoPointFieldGoals", "threePointFieldGoals", "freeThrows", "rebounds"]
64
+
65
+ class Config:
66
+ """Pydantic configuration"""
67
+ allow_population_by_field_name = True
68
+ validate_assignment = True
69
+
70
+ def to_str(self) -> str:
71
+ """Returns the string representation of the model using alias"""
72
+ return pprint.pformat(self.dict(by_alias=True))
73
+
74
+ def to_json(self) -> str:
75
+ """Returns the JSON representation of the model using alias"""
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> PlayerSeasonStats:
80
+ """Create an instance of PlayerSeasonStats from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self):
84
+ """Returns the dictionary representation of the model using alias"""
85
+ _dict = self.dict(by_alias=True,
86
+ exclude={
87
+ },
88
+ exclude_none=True)
89
+ # override the default output from pydantic by calling `to_dict()` of field_goals
90
+ if self.field_goals:
91
+ _dict['fieldGoals'] = self.field_goals.to_dict()
92
+ # override the default output from pydantic by calling `to_dict()` of two_point_field_goals
93
+ if self.two_point_field_goals:
94
+ _dict['twoPointFieldGoals'] = self.two_point_field_goals.to_dict()
95
+ # override the default output from pydantic by calling `to_dict()` of three_point_field_goals
96
+ if self.three_point_field_goals:
97
+ _dict['threePointFieldGoals'] = self.three_point_field_goals.to_dict()
98
+ # override the default output from pydantic by calling `to_dict()` of free_throws
99
+ if self.free_throws:
100
+ _dict['freeThrows'] = self.free_throws.to_dict()
101
+ # override the default output from pydantic by calling `to_dict()` of rebounds
102
+ if self.rebounds:
103
+ _dict['rebounds'] = self.rebounds.to_dict()
104
+ # set to None if conference (nullable) is None
105
+ # and __fields_set__ contains the field
106
+ if self.conference is None and "conference" in self.__fields_set__:
107
+ _dict['conference'] = None
108
+
109
+ # set to None if points (nullable) is None
110
+ # and __fields_set__ contains the field
111
+ if self.points is None and "points" in self.__fields_set__:
112
+ _dict['points'] = None
113
+
114
+ # set to None if turnovers (nullable) is None
115
+ # and __fields_set__ contains the field
116
+ if self.turnovers is None and "turnovers" in self.__fields_set__:
117
+ _dict['turnovers'] = None
118
+
119
+ # set to None if fouls (nullable) is None
120
+ # and __fields_set__ contains the field
121
+ if self.fouls is None and "fouls" in self.__fields_set__:
122
+ _dict['fouls'] = None
123
+
124
+ # set to None if assists (nullable) is None
125
+ # and __fields_set__ contains the field
126
+ if self.assists is None and "assists" in self.__fields_set__:
127
+ _dict['assists'] = None
128
+
129
+ # set to None if steals (nullable) is None
130
+ # and __fields_set__ contains the field
131
+ if self.steals is None and "steals" in self.__fields_set__:
132
+ _dict['steals'] = None
133
+
134
+ # set to None if blocks (nullable) is None
135
+ # and __fields_set__ contains the field
136
+ if self.blocks is None and "blocks" in self.__fields_set__:
137
+ _dict['blocks'] = None
138
+
139
+ # set to None if usage (nullable) is None
140
+ # and __fields_set__ contains the field
141
+ if self.usage is None and "usage" in self.__fields_set__:
142
+ _dict['usage'] = None
143
+
144
+ # set to None if offensive_rating (nullable) is None
145
+ # and __fields_set__ contains the field
146
+ if self.offensive_rating is None and "offensive_rating" in self.__fields_set__:
147
+ _dict['offensiveRating'] = None
148
+
149
+ # set to None if defensive_rating (nullable) is None
150
+ # and __fields_set__ contains the field
151
+ if self.defensive_rating is None and "defensive_rating" in self.__fields_set__:
152
+ _dict['defensiveRating'] = None
153
+
154
+ # set to None if net_rating (nullable) is None
155
+ # and __fields_set__ contains the field
156
+ if self.net_rating is None and "net_rating" in self.__fields_set__:
157
+ _dict['netRating'] = None
158
+
159
+ # set to None if effective_field_goal_pct (nullable) is None
160
+ # and __fields_set__ contains the field
161
+ if self.effective_field_goal_pct is None and "effective_field_goal_pct" in self.__fields_set__:
162
+ _dict['effectiveFieldGoalPct'] = None
163
+
164
+ # set to None if true_shooting_pct (nullable) is None
165
+ # and __fields_set__ contains the field
166
+ if self.true_shooting_pct is None and "true_shooting_pct" in self.__fields_set__:
167
+ _dict['trueShootingPct'] = None
168
+
169
+ # set to None if assists_turnover_ratio (nullable) is None
170
+ # and __fields_set__ contains the field
171
+ if self.assists_turnover_ratio is None and "assists_turnover_ratio" in self.__fields_set__:
172
+ _dict['assistsTurnoverRatio'] = None
173
+
174
+ # set to None if free_throw_rate (nullable) is None
175
+ # and __fields_set__ contains the field
176
+ if self.free_throw_rate is None and "free_throw_rate" in self.__fields_set__:
177
+ _dict['freeThrowRate'] = None
178
+
179
+ # set to None if offensive_rebound_pct (nullable) is None
180
+ # and __fields_set__ contains the field
181
+ if self.offensive_rebound_pct is None and "offensive_rebound_pct" in self.__fields_set__:
182
+ _dict['offensiveReboundPct'] = None
183
+
184
+ return _dict
185
+
186
+ @classmethod
187
+ def from_dict(cls, obj: dict) -> PlayerSeasonStats:
188
+ """Create an instance of PlayerSeasonStats from a dict"""
189
+ if obj is None:
190
+ return None
191
+
192
+ if not isinstance(obj, dict):
193
+ return PlayerSeasonStats.parse_obj(obj)
194
+
195
+ _obj = PlayerSeasonStats.parse_obj({
196
+ "season": obj.get("season"),
197
+ "season_label": obj.get("seasonLabel"),
198
+ "team_id": obj.get("teamId"),
199
+ "team": obj.get("team"),
200
+ "conference": obj.get("conference"),
201
+ "athlete_id": obj.get("athleteId"),
202
+ "athlete_source_id": obj.get("athleteSourceId"),
203
+ "name": obj.get("name"),
204
+ "position": obj.get("position"),
205
+ "games": obj.get("games"),
206
+ "starts": obj.get("starts"),
207
+ "minutes": obj.get("minutes"),
208
+ "points": obj.get("points"),
209
+ "turnovers": obj.get("turnovers"),
210
+ "fouls": obj.get("fouls"),
211
+ "assists": obj.get("assists"),
212
+ "steals": obj.get("steals"),
213
+ "blocks": obj.get("blocks"),
214
+ "usage": obj.get("usage"),
215
+ "offensive_rating": obj.get("offensiveRating"),
216
+ "defensive_rating": obj.get("defensiveRating"),
217
+ "net_rating": obj.get("netRating"),
218
+ "effective_field_goal_pct": obj.get("effectiveFieldGoalPct"),
219
+ "true_shooting_pct": obj.get("trueShootingPct"),
220
+ "assists_turnover_ratio": obj.get("assistsTurnoverRatio"),
221
+ "free_throw_rate": obj.get("freeThrowRate"),
222
+ "offensive_rebound_pct": obj.get("offensiveReboundPct"),
223
+ "field_goals": TeamSeasonUnitStatsFieldGoals.from_dict(obj.get("fieldGoals")) if obj.get("fieldGoals") is not None else None,
224
+ "two_point_field_goals": TeamSeasonUnitStatsFieldGoals.from_dict(obj.get("twoPointFieldGoals")) if obj.get("twoPointFieldGoals") is not None else None,
225
+ "three_point_field_goals": TeamSeasonUnitStatsFieldGoals.from_dict(obj.get("threePointFieldGoals")) if obj.get("threePointFieldGoals") is not None else None,
226
+ "free_throws": TeamSeasonUnitStatsFieldGoals.from_dict(obj.get("freeThrows")) if obj.get("freeThrows") is not None else None,
227
+ "rebounds": TeamSeasonUnitStatsRebounds.from_dict(obj.get("rebounds")) if obj.get("rebounds") is not None else None
228
+ })
229
+ return _obj
230
+
231
+
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ College Basketball Data API
5
+
6
+ This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Contact: admin@collegefootballdata.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ import json
17
+ import pprint
18
+ import re # noqa: F401
19
+ from aenum import Enum, no_arg
20
+
21
+
22
+
23
+
24
+
25
+ class SeasonType(str, Enum):
26
+ """
27
+ SeasonType
28
+ """
29
+
30
+ """
31
+ allowed enum values
32
+ """
33
+ POSTSEASON = 'postseason'
34
+ PRESEASON = 'preseason'
35
+ REGULAR = 'regular'
36
+
37
+ @classmethod
38
+ def from_json(cls, json_str: str) -> SeasonType:
39
+ """Create an instance of SeasonType from a JSON string"""
40
+ return SeasonType(json.loads(json_str))
41
+
42
+
@@ -0,0 +1,160 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ College Basketball Data API
5
+
6
+ This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Contact: admin@collegefootballdata.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+
22
+ from typing import Optional
23
+ from pydantic import BaseModel, Field, StrictInt, StrictStr
24
+
25
+ class TeamInfo(BaseModel):
26
+ """
27
+ TeamInfo
28
+ """
29
+ id: StrictInt = Field(...)
30
+ source_id: StrictStr = Field(default=..., alias="sourceId")
31
+ school: StrictStr = Field(...)
32
+ mascot: Optional[StrictStr] = Field(...)
33
+ abbreviation: Optional[StrictStr] = Field(...)
34
+ display_name: Optional[StrictStr] = Field(default=..., alias="displayName")
35
+ short_display_name: Optional[StrictStr] = Field(default=..., alias="shortDisplayName")
36
+ primary_color: Optional[StrictStr] = Field(default=..., alias="primaryColor")
37
+ secondary_color: Optional[StrictStr] = Field(default=..., alias="secondaryColor")
38
+ current_venue_id: Optional[StrictInt] = Field(default=..., alias="currentVenueId")
39
+ current_venue: Optional[StrictStr] = Field(default=..., alias="currentVenue")
40
+ current_city: Optional[StrictStr] = Field(default=..., alias="currentCity")
41
+ current_state: Optional[StrictStr] = Field(default=..., alias="currentState")
42
+ conference_id: Optional[StrictInt] = Field(default=..., alias="conferenceId")
43
+ conference: Optional[StrictStr] = Field(...)
44
+ __properties = ["id", "sourceId", "school", "mascot", "abbreviation", "displayName", "shortDisplayName", "primaryColor", "secondaryColor", "currentVenueId", "currentVenue", "currentCity", "currentState", "conferenceId", "conference"]
45
+
46
+ class Config:
47
+ """Pydantic configuration"""
48
+ allow_population_by_field_name = True
49
+ validate_assignment = True
50
+
51
+ def to_str(self) -> str:
52
+ """Returns the string representation of the model using alias"""
53
+ return pprint.pformat(self.dict(by_alias=True))
54
+
55
+ def to_json(self) -> str:
56
+ """Returns the JSON representation of the model using alias"""
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> TeamInfo:
61
+ """Create an instance of TeamInfo from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self):
65
+ """Returns the dictionary representation of the model using alias"""
66
+ _dict = self.dict(by_alias=True,
67
+ exclude={
68
+ },
69
+ exclude_none=True)
70
+ # set to None if mascot (nullable) is None
71
+ # and __fields_set__ contains the field
72
+ if self.mascot is None and "mascot" in self.__fields_set__:
73
+ _dict['mascot'] = None
74
+
75
+ # set to None if abbreviation (nullable) is None
76
+ # and __fields_set__ contains the field
77
+ if self.abbreviation is None and "abbreviation" in self.__fields_set__:
78
+ _dict['abbreviation'] = None
79
+
80
+ # set to None if display_name (nullable) is None
81
+ # and __fields_set__ contains the field
82
+ if self.display_name is None and "display_name" in self.__fields_set__:
83
+ _dict['displayName'] = None
84
+
85
+ # set to None if short_display_name (nullable) is None
86
+ # and __fields_set__ contains the field
87
+ if self.short_display_name is None and "short_display_name" in self.__fields_set__:
88
+ _dict['shortDisplayName'] = None
89
+
90
+ # set to None if primary_color (nullable) is None
91
+ # and __fields_set__ contains the field
92
+ if self.primary_color is None and "primary_color" in self.__fields_set__:
93
+ _dict['primaryColor'] = None
94
+
95
+ # set to None if secondary_color (nullable) is None
96
+ # and __fields_set__ contains the field
97
+ if self.secondary_color is None and "secondary_color" in self.__fields_set__:
98
+ _dict['secondaryColor'] = None
99
+
100
+ # set to None if current_venue_id (nullable) is None
101
+ # and __fields_set__ contains the field
102
+ if self.current_venue_id is None and "current_venue_id" in self.__fields_set__:
103
+ _dict['currentVenueId'] = None
104
+
105
+ # set to None if current_venue (nullable) is None
106
+ # and __fields_set__ contains the field
107
+ if self.current_venue is None and "current_venue" in self.__fields_set__:
108
+ _dict['currentVenue'] = None
109
+
110
+ # set to None if current_city (nullable) is None
111
+ # and __fields_set__ contains the field
112
+ if self.current_city is None and "current_city" in self.__fields_set__:
113
+ _dict['currentCity'] = None
114
+
115
+ # set to None if current_state (nullable) is None
116
+ # and __fields_set__ contains the field
117
+ if self.current_state is None and "current_state" in self.__fields_set__:
118
+ _dict['currentState'] = None
119
+
120
+ # set to None if conference_id (nullable) is None
121
+ # and __fields_set__ contains the field
122
+ if self.conference_id is None and "conference_id" in self.__fields_set__:
123
+ _dict['conferenceId'] = None
124
+
125
+ # set to None if conference (nullable) is None
126
+ # and __fields_set__ contains the field
127
+ if self.conference is None and "conference" in self.__fields_set__:
128
+ _dict['conference'] = None
129
+
130
+ return _dict
131
+
132
+ @classmethod
133
+ def from_dict(cls, obj: dict) -> TeamInfo:
134
+ """Create an instance of TeamInfo from a dict"""
135
+ if obj is None:
136
+ return None
137
+
138
+ if not isinstance(obj, dict):
139
+ return TeamInfo.parse_obj(obj)
140
+
141
+ _obj = TeamInfo.parse_obj({
142
+ "id": obj.get("id"),
143
+ "source_id": obj.get("sourceId"),
144
+ "school": obj.get("school"),
145
+ "mascot": obj.get("mascot"),
146
+ "abbreviation": obj.get("abbreviation"),
147
+ "display_name": obj.get("displayName"),
148
+ "short_display_name": obj.get("shortDisplayName"),
149
+ "primary_color": obj.get("primaryColor"),
150
+ "secondary_color": obj.get("secondaryColor"),
151
+ "current_venue_id": obj.get("currentVenueId"),
152
+ "current_venue": obj.get("currentVenue"),
153
+ "current_city": obj.get("currentCity"),
154
+ "current_state": obj.get("currentState"),
155
+ "conference_id": obj.get("conferenceId"),
156
+ "conference": obj.get("conference")
157
+ })
158
+ return _obj
159
+
160
+
@@ -0,0 +1,112 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ College Basketball Data API
5
+
6
+ This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Contact: admin@collegefootballdata.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+
22
+ from typing import Optional, Union
23
+ from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr
24
+ from cbbd.models.team_season_unit_stats import TeamSeasonUnitStats
25
+
26
+ class TeamSeasonStats(BaseModel):
27
+ """
28
+ TeamSeasonStats
29
+ """
30
+ season: StrictInt = Field(...)
31
+ season_label: StrictStr = Field(default=..., alias="seasonLabel")
32
+ team_id: StrictInt = Field(default=..., alias="teamId")
33
+ team: StrictStr = Field(...)
34
+ conference: Optional[StrictStr] = Field(...)
35
+ games: StrictInt = Field(...)
36
+ total_minutes: Optional[Union[StrictFloat, StrictInt]] = Field(default=..., alias="totalMinutes")
37
+ pace: Optional[Union[StrictFloat, StrictInt]] = Field(...)
38
+ offense: TeamSeasonUnitStats = Field(...)
39
+ defense: TeamSeasonUnitStats = Field(...)
40
+ __properties = ["season", "seasonLabel", "teamId", "team", "conference", "games", "totalMinutes", "pace", "offense", "defense"]
41
+
42
+ class Config:
43
+ """Pydantic configuration"""
44
+ allow_population_by_field_name = True
45
+ validate_assignment = True
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.dict(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> TeamSeasonStats:
57
+ """Create an instance of TeamSeasonStats from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self):
61
+ """Returns the dictionary representation of the model using alias"""
62
+ _dict = self.dict(by_alias=True,
63
+ exclude={
64
+ },
65
+ exclude_none=True)
66
+ # override the default output from pydantic by calling `to_dict()` of offense
67
+ if self.offense:
68
+ _dict['offense'] = self.offense.to_dict()
69
+ # override the default output from pydantic by calling `to_dict()` of defense
70
+ if self.defense:
71
+ _dict['defense'] = self.defense.to_dict()
72
+ # set to None if conference (nullable) is None
73
+ # and __fields_set__ contains the field
74
+ if self.conference is None and "conference" in self.__fields_set__:
75
+ _dict['conference'] = None
76
+
77
+ # set to None if total_minutes (nullable) is None
78
+ # and __fields_set__ contains the field
79
+ if self.total_minutes is None and "total_minutes" in self.__fields_set__:
80
+ _dict['totalMinutes'] = None
81
+
82
+ # set to None if pace (nullable) is None
83
+ # and __fields_set__ contains the field
84
+ if self.pace is None and "pace" in self.__fields_set__:
85
+ _dict['pace'] = None
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: dict) -> TeamSeasonStats:
91
+ """Create an instance of TeamSeasonStats from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return TeamSeasonStats.parse_obj(obj)
97
+
98
+ _obj = TeamSeasonStats.parse_obj({
99
+ "season": obj.get("season"),
100
+ "season_label": obj.get("seasonLabel"),
101
+ "team_id": obj.get("teamId"),
102
+ "team": obj.get("team"),
103
+ "conference": obj.get("conference"),
104
+ "games": obj.get("games"),
105
+ "total_minutes": obj.get("totalMinutes"),
106
+ "pace": obj.get("pace"),
107
+ "offense": TeamSeasonUnitStats.from_dict(obj.get("offense")) if obj.get("offense") is not None else None,
108
+ "defense": TeamSeasonUnitStats.from_dict(obj.get("defense")) if obj.get("defense") is not None else None
109
+ })
110
+ return _obj
111
+
112
+