Exemple #1
0
 def load(node, first):
     answer = Innings()
     data = ModelObject.extractData(node)
     value = data.get('runsScored', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get("wicketsLost", None)
     if value != None:
         answer.wickets = int(value[0].text)
     value = data.get("ballsBowled", None)
     if value != None:
         answer.balls = int(value[0].text)
     value = data.get("wicketsLost", None)
     if value != None:
         answer.wickets = int(value[0].text)
     answer.first = first
     value = data.get("batsman")
     if (value != None):
         for child in value:
             batsman = Batsman.load(child)
             answer.batsmen[batsman.playerId] = batsman
     value = data.get("bowler")
     if (value != None):
         for child in value:
             bowler = Bowler.load(child)
             answer.bowlers[bowler.playerId] = bowler
     return answer
Exemple #2
0
 def load(node, first):
     answer = Innings()
     data = ModelObject.extractData(node)
     value = data.get('runsScored', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get("wicketsLost", None)
     if value != None:
         answer.wickets = int(value[0].text)
     value = data.get("ballsBowled", None)
     if value != None:
         answer.balls = int(value[0].text)
     value = data.get("wicketsLost", None)
     if value != None:
         answer.wickets = int(value[0].text)
     answer.first = first
     value = data.get("batsman")
     if (value != None):
         for child in value:
             batsman = Batsman.load(child)
             answer.batsmen[batsman.playerId] = batsman
     value = data.get("bowler")
     if (value != None):
         for child in value:
             bowler = Bowler.load(child)
             answer.bowlers[bowler.playerId] = bowler
     return answer
Exemple #3
0
 def load(node):
     answer = Player()
     data = ModelObject.extractData(node)
     value = data.get('name', None)
     if value != None:
         answer.name = value[0].text
     value = data.get('id', None)
     if value != None:
         answer.id = value
     return answer
Exemple #4
0
 def load(node):
     answer = Batsman()
     data = ModelObject.extractData(node)
     value = data.get('player', None)
     if value != None:
         answer.playerId = value
     value = data.get('runs', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get('out', None)
     if value != None:
         answer.out = value[0].text == 'true'
     return answer
Exemple #5
0
 def load(node):
     answer = Batsman()
     data = ModelObject.extractData(node)
     value = data.get('player', None)
     if value != None:
         answer.playerId = value
     value = data.get('runs', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get('out', None)
     if value != None:
         answer.out = value[0].text == 'true'
     return answer
Exemple #6
0
 def load(node):
     answer = Bowler()
     data = ModelObject.extractData(node)
     value = data.get('player', None)
     if value != None:
         answer.playerId = value
     value = data.get('ballsBowled', None)
     if value != None:
         answer.balls = int(value[0].text)
     value = data.get('runs', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get('wickets', None)
     if value != None:
         answer.wickets = int(value[0].text)
     return answer
Exemple #7
0
 def load(node):
     answer = Bowler()
     data = ModelObject.extractData(node)
     value = data.get('player', None)
     if value != None:
         answer.playerId = value
     value = data.get('ballsBowled', None)
     if value != None:
         answer.balls = int(value[0].text)
     value = data.get('runs', None)
     if value != None:
         answer.runs = int(value[0].text)
     value = data.get('wickets', None)
     if value != None:
         answer.wickets = int(value[0].text)
     return answer
Exemple #8
0
 def load(node):
     answer = Team()
     data = ModelObject.extractData(node)
     value = data.get('name', None)
     if value != None:
         answer.name = value[0].text
     value = data.get('id', None)
     if value != None:
         answer.id = value
     value = data.get('player', None)
     if value != None:
         for child in value:
             player = Player.load(child)
             answer.players[player.id] = player
     value = data.get("pointsDeduction")
     if value != None:
         for child in value:
             points = int(child.find("points").text)
             reason = child.find("reason").text
             answer.deductions.append([points, reason])
     return answer
Exemple #9
0
 def load(node):
     answer = Team();
     data = ModelObject.extractData(node)
     value = data.get('name', None)
     if value != None:
         answer.name = value[0].text
     value = data.get('id', None)
     if value != None:
         answer.id = value
     value = data.get('player', None)
     if value != None:
         for child in value:
             player = Player.load(child)
             answer.players[player.id] = player
     value = data.get("pointsDeduction")
     if value != None:
         for child in value:
             points = int(child.find("points").text)
             reason = child.find("reason").text
             answer.deductions.append([points, reason])
     return answer
Exemple #10
0
 def load(node):
     answer = Match() 
     data = ModelObject.extractData(node);
     value = data.get('date', None)
     if value != None:
         answer.datetime = datetime.strptime(value[0].text, "%Y-%m-%d.%H:%M")
     value = data.get('pitch')
     if value != None:
         answer.court = value[0].text
     for k in ['homeTeam', 'awayTeam']:
         value = data.get(k)
         if value != None:
             answer.teams.append(value[0].attrib['id'])
     value = data.get("awardedMatch", None)
     if value != None:
         winner = value[0].find("winner").attrib['id']
         reason = value[0].find("reason").text
         answer.awarded = [winner, reason]
     value = data.get("playedMatch", None)
     if value != None:
         
     return answer