diff options
author | emkael <emkael@tlen.pl> | 2014-10-29 15:28:32 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2014-10-29 15:28:32 +0100 |
commit | 837039ff07a1d32602788d5fcc4aff236ee53d47 (patch) | |
tree | 7381023b955ef6fa93007133f13b6eb7a9b14e19 /f1elo/elo.py | |
parent | 477840592693ad3432a2d94b4bd892f0970a9f3a (diff) |
* autopep8 + isort
Diffstat (limited to 'f1elo/elo.py')
-rw-r--r-- | f1elo/elo.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/f1elo/elo.py b/f1elo/elo.py index 6a007d8..51c9e23 100644 --- a/f1elo/elo.py +++ b/f1elo/elo.py @@ -7,9 +7,11 @@ from f1elo.model import * class Elo: + def __init__(self, session): self.session = session - self.config = json.load(open(path.join(path.dirname(__main__.__file__), 'config', 'elo.json'))) + self.config = json.load( + open(path.join(path.dirname(__main__.__file__), 'config', 'elo.json'))) def get_ranking(self, driver, rank_date=None): rank = driver.get_ranking(rank_date) @@ -31,7 +33,12 @@ class Elo: if e.result_group: entries_to_compare.append(e) for c in combinations(entries_to_compare, 2): - score = self.get_score(rankings[c[0]] - rankings[c[1]], self.get_outcome(c), self.get_importance(race, [rankings[c[0]], rankings[c[1]]])) + score = self.get_score( + rankings[c[0]] - rankings[c[1]], + self.get_outcome(c), + self.get_importance(race, + [rankings[c[0]], + rankings[c[1]]])) new_rankings[c[0]] += score new_rankings[c[1]] -= score return new_rankings @@ -45,7 +52,6 @@ class Elo: return base_importance * 0.75 return base_importance / 2 - def get_outcome(self, entries): if entries[0].result_group < entries[1].result_group: return 1 |