summaryrefslogtreecommitdiff
path: root/jfr_playoff/data.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-08-01 14:06:25 +0200
committeremkael <emkael@tlen.pl>2017-08-01 14:06:25 +0200
commitca6c87f457f49cf33f357984d7642b1c83a0eefb (patch)
tree52cb557a89f7819a844ee394b1c0ccadbb52c607 /jfr_playoff/data.py
parentde7260322d60eeb5fd0afa57ec2e250ce7f52261 (diff)
Code formatting
Diffstat (limited to 'jfr_playoff/data.py')
-rw-r--r--jfr_playoff/data.py38
1 files changed, 16 insertions, 22 deletions
diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py
index db65393..6fc3c4b 100644
--- a/jfr_playoff/data.py
+++ b/jfr_playoff/data.py
@@ -49,8 +49,7 @@ class PlayoffData(object):
self.match_info[match['id']].link = phase['link']
else:
self.match_info[match['id']].link = urljoin(
- phase['link'], self.match_info[match['id']].link
- )
+ phase['link'], self.match_info[match['id']].link)
return self.match_info
def get_match_link(self, match):
@@ -67,8 +66,7 @@ class PlayoffData(object):
teams = [Team(), Team()]
row = self.database.fetch(
match['database'], p_sql.MATCH_RESULTS,
- (match['table'], match['round'])
- )
+ (match['table'], match['round']))
teams[0].name = row[0]
teams[1].name = row[1]
teams[0].score = row[3] + row[5]
@@ -91,27 +89,24 @@ class PlayoffData(object):
if 'winner' in match['teams'][i]:
match_teams += [
self.match_info[winner_match].winner
- for winner_match in match['teams'][i]['winner']
- ]
+ for winner_match in match['teams'][i]['winner']]
if 'loser' in match['teams'][i]:
match_teams += [
self.match_info[loser_match].loser
- for loser_match in match['teams'][i]['loser']
- ]
+ for loser_match in match['teams'][i]['loser']]
if 'place' in match['teams'][i]:
match_teams += [
self.teams[place-1][0]
- for place in match['teams'][i]['place']
- ]
+ for place in match['teams'][i]['place']]
known_teams = [team for team in match_teams if team is not None]
if len(known_teams) > 0:
teams[i].name = '<br />'.join([
- team if team is not None else '??' for team in match_teams])
+ team if team is not None
+ else '??' for team in match_teams])
else:
teams[i].name = ''
return teams
-
def get_match_info(self, match):
info = Match()
info.id = match['id']
@@ -132,14 +127,12 @@ class PlayoffData(object):
try:
towels = self.database.fetch(
match['database'], p_sql.TOWEL_COUNT,
- (match['table'], match['round'])
- )
+ (match['table'], match['round']))
row = [0 if r is None
else r for r in
self.database.fetch(
match['database'], p_sql.BOARD_COUNT,
- (match['table'], match['round'])
- )]
+ (match['table'], match['round']))]
if row[1] > 0:
info.running = int(row[1])
if row[1] >= row[0] - towels[0]:
@@ -170,15 +163,18 @@ class PlayoffData(object):
winner_key = tuple(match['winner'])
if winner_key not in leaderboard_teams:
leaderboard_teams[winner_key] = []
- leaderboard_teams[winner_key].append(self.match_info[match['id']].winner)
+ leaderboard_teams[winner_key].append(
+ self.match_info[match['id']].winner)
if 'loser' in match:
loser_key = tuple(match['loser'])
if loser_key not in leaderboard_teams:
leaderboard_teams[loser_key] = []
- leaderboard_teams[loser_key].append(self.match_info[match['id']].loser)
+ leaderboard_teams[loser_key].append(
+ self.match_info[match['id']].loser)
for positions, position_teams in leaderboard_teams.iteritems():
positions = list(positions)
- if len(positions) == len([team for team in position_teams if team is not None]):
+ if len(positions) == len([
+ team for team in position_teams if team is not None]):
for table_team in self.teams:
if table_team[0] in position_teams:
position = positions.pop(0)
@@ -192,9 +188,7 @@ class PlayoffData(object):
len(phase['matches']) + len(phase['dummies'])
if 'dummies' in phase
else len(phase['matches'])
- for phase in self.phases
- ])
- )
+ for phase in self.phases]))
def get_shortname(self, fullname):
for team in self.teams: