1- from dataclasses import dataclass , field
2- from typing import List , Optional , Union
3-
4- from .attributes import School , Home
1+ from typing import List , Optional
2+ from pydantic import Field
3+ from mlbstatsapi .models .base import MLBBaseModel
54from mlbstatsapi .models .teams import Team
65from mlbstatsapi .models .people import Person
76from mlbstatsapi .models .data import CodeDesc
7+ from .attributes import DraftSchool , DraftHome
8+
89
9- @dataclass (repr = False )
10- class DraftPick :
10+ class DraftPick (MLBBaseModel ):
1111 """
12- Represents a pick made in the MLB draft.
12+ A class representing a pick made in the MLB draft.
1313
1414 Attributes
1515 ----------
16- bisplayerid : int
17- The unique identifier of the player associated with this draft pick.
18- pickround : str
16+ team : Team
17+ The team that made this draft pick.
18+ draft_type : CodeDesc
19+ Information about the type of draft in which this pick was made.
20+ is_drafted : bool
21+ Whether or not the player associated with this pick has been drafted.
22+ is_pass : bool
23+ Whether or not the team passed on making a pick in this round.
24+ year : str
25+ The year in which the draft took place.
26+ school : DraftSchool
27+ Information about the player's school or college.
28+ home : DraftHome
29+ Information about the player's home location.
30+ pick_round : str
1931 The round of the draft in which this pick was made.
20- picknumber : int
32+ pick_number : int
2133 The number of the pick in the round.
22- displaypicknumber : int
34+ display_pick_number : int
2335 The overall pick number displayed.
24- roundpicknumber : int
36+ round_pick_number : int
2537 The number of the pick overall in the draft.
38+ headshot_link : str
39+ A link to a headshot image of the player.
40+ person : Person
41+ The person drafted.
42+ bis_player_id : int
43+ The unique identifier of the player associated with this draft pick.
2644 rank : int
2745 The rank of the player among all players eligible for the draft.
28- pickvalue : str
46+ pick_value : str
2947 The value of the pick, if known.
30- signingbonus : str
48+ signing_bonus : str
3149 The signing bonus associated with this pick, if known.
32- home : Home
33- Information about the player's home location.
34- scoutingreport : str
35- A scouting report on the player's abilities.
36- school : School
37- Information about the player's school or college.
50+ scouting_report : str
51+ A scouting report on the player's abilities.
3852 blurb : str
39- A brief summary of the player's background and accomplishments.
40- headshotlink : str
41- A link to a headshot image of the player.
42- team : Team or dict
43- The team that made this draft pick.
44- drafttype : CodeDesc
45- Information about the type of draft in which this pick was made.
46- isdrafted : bool
47- Whether or not the player associated with this pick has been drafted.
48- ispass : bool
49- Whether or not the team passed on making a pick in this round.
50- year : str
51- The year in which the draft took place.
53+ A brief summary of the player's background and accomplishments.
5254 """
53- team : Union [ Team , dict ]
54- drafttype : Union [ CodeDesc , dict ]
55- isdrafted : bool
56- ispass : bool
55+ team : Team
56+ draft_type : CodeDesc = Field ( alias = "drafttype" )
57+ is_drafted : bool = Field ( alias = "isdrafted" )
58+ is_pass : bool = Field ( alias = "ispass" )
5759 year : str
58- school : Union [ School , dict ]
59- home : Union [ Home , dict ]
60- pickround : str
61- picknumber : int
62- displaypicknumber : int
63- roundpicknumber : int
64- headshotlink : Optional [str ] = None
65- person : Optional [Union [ Person , dict ] ] = None
66- bisplayerid : Optional [int ] = None
60+ school : DraftSchool
61+ home : DraftHome
62+ pick_round : str = Field ( alias = "pickround" )
63+ pick_number : int = Field ( alias = "picknumber" )
64+ display_pick_number : int = Field ( alias = "displaypicknumber" )
65+ round_pick_number : int = Field ( alias = "roundpicknumber" )
66+ headshot_link : Optional [str ] = Field ( default = None , alias = "headshotlink" )
67+ person : Optional [Person ] = None
68+ bis_player_id : Optional [int ] = Field ( default = None , alias = "bisplayerid" )
6769 rank : Optional [int ] = None
68- pickvalue : Optional [str ] = None
69- signingbonus : Optional [str ] = None
70- scoutingreport : Optional [str ] = None
70+ pick_value : Optional [str ] = Field ( default = None , alias = "pickvalue" )
71+ signing_bonus : Optional [str ] = Field ( default = None , alias = "signingbonus" )
72+ scouting_report : Optional [str ] = Field ( default = None , alias = "scoutingreport" )
7173 blurb : Optional [str ] = None
7274
73- def __repr__ (self ) -> str :
74- kws = [f'{ key } ={ value } ' for key , value in self .__dict__ .items () if value is not None and value ]
75- return "{}({})" .format (type (self ).__name__ , ", " .join (kws ))
7675
77- @dataclass (repr = False )
78- class Round :
76+ class Round (MLBBaseModel ):
7977 """
80- Represents a round of the MLB draft.
78+ A class representing a round of the MLB draft.
8179
8280 Attributes
8381 ----------
8482 round : str
8583 The round number of the draft, represented as a string.
8684 picks : List[DraftPick]
87- A list of DraftPick objects representing the picks made in this round of the draft .
85+ A list of DraftPick objects representing the picks made in this round.
8886 """
8987 round : str
90- picks : List [DraftPick ]
91-
92- def __post_init__ (self ):
93- self .picks = [DraftPick (** pick ) for pick in self .picks ]
94-
95- def __repr__ (self ) -> str :
96- kws = [f'{ key } ={ value } ' for key , value in self .__dict__ .items () if value is not None and value ]
97- return "{}({})" .format (type (self ).__name__ , ", " .join (kws ))
88+ picks : List [DraftPick ] = []
0 commit comments