Example #1
0
 def __init__(self, player):
     self.raw = player
     self.firstname = utils.remove_accents(
         player.find('PersonName').find('First').text)
     self.lastname = utils.remove_accents(
         player.find('PersonName').find('Last').text)
     self.position = player['Position']
     self.id = int(player['uID'][1:])
Example #2
0
 def add_gamedata(self,gamedata,match,typeids,qualids):
     self.homegoals = int(gamedata['home_score'])
     self.awaygoals = int(gamedata['away_score'])
     assert utils.remove_accents( gamedata['home_team_name'] ) == self.hometeam.teamname
     assert utils.remove_accents( gamedata['away_team_name'] ) == self.awayteam.teamname
     self.season = gamedata['season_id']
     date_check = dt.datetime.strptime( gamedata['game_date'][:10], '%Y-%m-%d')
     assert date_check==self.date
     eventdata = gamedata.find_all('Event')
     self.events = []
     for event in eventdata:
         self.events.append(OPTAevent(event,match,typeids,qualids))
Example #3
0
 def __init__(self, team, homeaway):
     self.raw = team
     self.homeaway = homeaway
     self.country = team.find('Country').text
     self.team_id = int(team['uID'][1:])
     self.teamname = utils.remove_accents(team.find('Name').text)
     self.players = []
     self.get_players()
Example #4
0
    def __init__(self, player):
        self.raw = player
        self.firstname = utils.remove_accents(
            player.find('PersonName').find('First').text)
        self.lastname = utils.remove_accents(
            player.find('PersonName').find('Last').text)
        self.position = player['Position']
        self.id = int(player['uID'][1:])

        # player position
        # TODO: set default coordinates based on position
        self.x = 0
        self.y = 0
        self.cov = None

        # how many passes were made to each player
        self.pass_destinations = {}
Example #5
0
 def __init__(self,team,matchdata,homeaway):
     self.raw = team
     self.homeaway = homeaway
     ha = lambda x: 'Home' if x=='H' else 'Away'
     squad = matchdata.find('TeamData',attrs={'Side':ha(homeaway)})
     self.country = team.find('Country').text
     self.team_id = int( team['uID'][1:] )
     self.teamname = utils.remove_accents(  team.find('Name').text )
     self.players = []
     formation_map = OPTA_formations.opta_formation_map()[squad['Formation']]
     self.get_players(squad,formation_map)