Skip to content

Commit 5063537

Browse files
authored
Merge pull request #229 from jribarich/patch_missing_live_feed_keys
set missing keys to default values of None
2 parents 887fda7 + 1a20fea commit 5063537

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

mlbstatsapi/models/data/data.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class PitchBreak:
2424
spindirection : int
2525
Pitch spinDirection
2626
"""
27-
breakangle: float
28-
breaklength: float
29-
breaky: float
27+
breakangle: Optional[float]
3028
breakvertical: Optional[float]
3129
breakverticalinduced: Optional[float]
3230
breakhorizontal: Optional[float]
3331
spinrate: Optional[float] = None
3432
spindirection: Optional[float] = None
33+
breaklength: Optional[float] = None
34+
breaky: Optional[float] = None
3535

3636
def __repr__(self) -> str:
3737
kws = [f'{key}={value}' for key, value in self.__dict__.items() if value is not None]
@@ -203,9 +203,9 @@ class HitData:
203203
"""
204204

205205

206-
trajectory: str
207-
hardness: str
208206
coordinates: Union[HitCoordinates, dict]
207+
trajectory: Optional[str] = None
208+
hardness: Optional[str] = None
209209
location: Optional[int] = None
210210
launchspeed: Optional[float] = None
211211
launchangle: Optional[str] = None # this is a negative number and I'm brain farting on those

mlbstatsapi/models/game/livedata/plays/play/attributes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class PlayResult:
7272
If the play was an out
7373
"""
7474
type: str
75-
rbi: int
7675
awayscore: int
7776
homescore: int
77+
rbi: Optional[int] = None
7878
event: Optional[str] = None
7979
eventtype: Optional[str] = None
8080
description: Optional[str] = None
@@ -108,4 +108,4 @@ class PlayReviewDetails:
108108

109109
def __repr__(self) -> str:
110110
kws = [f'{key}={value}' for key, value in self.__dict__.items() if value is not None]
111-
return "{}({})".format(type(self).__name__, ", ".join(kws))
111+
return "{}({})".format(type(self).__name__, ", ".join(kws))

0 commit comments

Comments
 (0)