Thibault Duplessis commited on
Commit
04a7c7f
·
1 Parent(s): 5f3f15f

fix pyton coding standards

Browse files
Files changed (1) hide show
  1. model.py +9 -9
model.py CHANGED
@@ -10,11 +10,11 @@ class Challenge():
10
  self.perf_name = c_info["perf"]["name"]
11
  self.speed = c_info["speed"]
12
  self.challenger = c_info.get("challenger")
13
- self.challengerTitle = self.challenger.get("title") if self.challenger else None
14
- self.challengerMasterTitle = self.challengerTitle if self.challengerTitle != "BOT" else None
15
- self.challengerName = self.challenger["name"] if self.challenger else "Anonymous"
16
- self.challengerRatingInt = self.challenger["rating"] if self.challenger else 0
17
- self.challengerRating = self.challengerRatingInt or "?"
18
 
19
  def is_supported_variant(self, supported):
20
  return self.variant in supported
@@ -33,17 +33,17 @@ class Challenge():
33
 
34
  def score(self):
35
  ratedBonus = 200 if self.rated else 0
36
- titledBonus = 200 if self.challengerMasterTitle else 0
37
- return self.challengerRatingInt + ratedBonus + titledBonus
38
 
39
  def mode(self):
40
  return "rated" if self.rated else "casual"
41
 
42
  def challengerFullName(self):
43
- return "{}{}".format(self.challengerTitle + " " if self.challengerTitle else "", self.challengerName)
44
 
45
  def __str__(self):
46
- return "{} {} challenge from {}({})".format(self.perf_name, self.mode(), self.challengerFullName(), self.challengerRating)
47
 
48
  def __repr__(self):
49
  return self.__str__()
 
10
  self.perf_name = c_info["perf"]["name"]
11
  self.speed = c_info["speed"]
12
  self.challenger = c_info.get("challenger")
13
+ self.challenger_title = self.challenger.get("title") if self.challenger else None
14
+ self.challenger_master_title = self.challenger_title if self.challenger_title != "BOT" else None
15
+ self.challenger_name = self.challenger["name"] if self.challenger else "Anonymous"
16
+ self.challenger_rating_int = self.challenger["rating"] if self.challenger else 0
17
+ self.challenger_rating = self.challenger_rating_int or "?"
18
 
19
  def is_supported_variant(self, supported):
20
  return self.variant in supported
 
33
 
34
  def score(self):
35
  ratedBonus = 200 if self.rated else 0
36
+ titledBonus = 200 if self.challenger_master_title else 0
37
+ return self.challenger_rating_int + ratedBonus + titledBonus
38
 
39
  def mode(self):
40
  return "rated" if self.rated else "casual"
41
 
42
  def challengerFullName(self):
43
+ return "{}{}".format(self.challenger_title + " " if self.challenger_title else "", self.challenger_name)
44
 
45
  def __str__(self):
46
+ return "{} {} challenge from {}({})".format(self.perf_name, self.mode(), self.challengerFullName(), self.challenger_rating)
47
 
48
  def __repr__(self):
49
  return self.__str__()