-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/statistics
# Conflicts: # kloppy/infra/serializers/event/statsbomb/helpers.py # kloppy/infra/serializers/event/statsbomb/specification.py # kloppy/infra/serializers/event/statsperform/deserializer.py # kloppy/infra/serializers/tracking/statsperform.py # kloppy/infra/serializers/tracking/tracab/tracab_json.py
- Loading branch information
Showing
47 changed files
with
157,382 additions
and
4,464 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/ambv/black | ||
rev: 23.3.0 | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
from enum import Enum | ||
|
||
|
||
class PositionType(Enum): | ||
Unknown = ("Unknown", "UNK", None) | ||
|
||
Goalkeeper = ("Goalkeeper", "GK", None) | ||
|
||
Defender = ("Defender", "DEF", None) | ||
FullBack = ("Full Back", "FB", "Defender") | ||
LeftBack = ("Left Back", "LB", "FullBack") | ||
RightBack = ("Right Back", "RB", "FullBack") | ||
CenterBack = ("Center Back", "CB", "Defender") | ||
LeftCenterBack = ("Left Center Back", "LCB", "CenterBack") | ||
RightCenterBack = ("Right Center Back", "RCB", "CenterBack") | ||
|
||
Midfielder = ("Midfielder", "MID", None) | ||
DefensiveMidfield = ("Defensive Midfield", "DM", "Midfielder") | ||
LeftDefensiveMidfield = ( | ||
"Left Defensive Midfield", | ||
"LDM", | ||
"DefensiveMidfield", | ||
) | ||
CenterDefensiveMidfield = ( | ||
"Center Defensive Midfield", | ||
"CDM", | ||
"DefensiveMidfield", | ||
) | ||
RightDefensiveMidfield = ( | ||
"Right Defensive Midfield", | ||
"RDM", | ||
"DefensiveMidfield", | ||
) | ||
|
||
CentralMidfield = ("Central Midfield", "CM", "Midfielder") | ||
LeftCentralMidfield = ("Left Central Midfield", "LCM", "CentralMidfield") | ||
CenterMidfield = ("Center Midfield", "CM", "CentralMidfield") | ||
RightCentralMidfield = ("Right Central Midfield", "RCM", "CentralMidfield") | ||
|
||
AttackingMidfield = ("Attacking Midfield", "AM", "Midfielder") | ||
LeftAttackingMidfield = ( | ||
"Left Attacking Midfield", | ||
"LAM", | ||
"AttackingMidfield", | ||
) | ||
CenterAttackingMidfield = ( | ||
"Center Attacking Midfield", | ||
"CAM", | ||
"AttackingMidfield", | ||
) | ||
RightAttackingMidfield = ( | ||
"Right Attacking Midfield", | ||
"RAM", | ||
"AttackingMidfield", | ||
) | ||
|
||
WideMidfield = ("Wide Midfield", "WM", "Midfielder") | ||
LeftWing = ("Left Wing", "LW", "WideMidfield") | ||
RightWing = ("Right Wing", "RW", "WideMidfield") | ||
LeftMidfield = ("Left Midfield", "LM", "WideMidfield") | ||
RightMidfield = ("Right Midfield", "RM", "WideMidfield") | ||
|
||
Attacker = ("Attacker", "ATT", None) | ||
LeftForward = ("Left Forward", "LF", "Attacker") | ||
Striker = ("Striker", "ST", "Attacker") | ||
RightForward = ("Right Forward", "RF", "Attacker") | ||
|
||
def __init__(self, long_name, code, parent): | ||
self.long_name = long_name | ||
self.code = code | ||
self._parent = parent | ||
|
||
@property | ||
def parent(self): | ||
if self._parent: | ||
return PositionType[self._parent] | ||
return None | ||
|
||
def is_subtype_of(self, other): | ||
current = self | ||
while current is not None: | ||
if current == other: | ||
return True | ||
current = current.parent | ||
return False | ||
|
||
def __str__(self): | ||
return self.long_name | ||
|
||
@classmethod | ||
def unknown(cls) -> "PositionType": | ||
return cls.Unknown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.