@@ -23,9 +23,12 @@ class Project(models.Model):
2323 repo_type = models .CharField (
2424 "Repository type" , max_length = 1 , choices = REPO_TYPES , default = 'N' )
2525 repo_path = models .CharField ("Repository URL" , blank = True , max_length = 200 )
26- repo_user = models .CharField ("Repository username" , blank = True , max_length = 100 )
27- repo_pass = models .CharField ("Repository password" , blank = True , max_length = 100 )
28- commit_browsing_url = models .CharField ("Commit browsing URL" , blank = True , max_length = 200 )
26+ repo_user = models .CharField ("Repository username" ,
27+ blank = True , max_length = 100 )
28+ repo_pass = models .CharField ("Repository password" ,
29+ blank = True , max_length = 100 )
30+ commit_browsing_url = models .CharField ("Commit browsing URL" ,
31+ blank = True , max_length = 200 )
2932 track = models .BooleanField ("Track changes" , default = False )
3033
3134 def __unicode__ (self ):
@@ -78,10 +81,9 @@ class Revision(models.Model):
7881 tag = models .CharField (max_length = 20 , blank = True )
7982 date = models .DateTimeField (null = True )
8083 message = models .TextField (blank = True )
81- project = models .ForeignKey (Project , related_name = "revisions" , null = True , blank = True )
82- # TODO: Replace author with author name/email or just make it larger so we can do "name <email>"?
84+ project = models .ForeignKey (Project , related_name = "revisions" ,
85+ null = True , blank = True )
8386 author = models .CharField (max_length = 30 , blank = True )
84- # TODO: Add committer field(s) for DVCSes which make the distinction?
8587 branch = models .ForeignKey (Branch , related_name = "revisions" )
8688
8789 def get_short_commitid (self ):
@@ -132,7 +134,8 @@ class Benchmark(models.Model):
132134 )
133135
134136 name = models .CharField (unique = True , max_length = 30 )
135- parent = models .ForeignKey ('self' , verbose_name = "parent" ,
137+ parent = models .ForeignKey (
138+ 'self' , verbose_name = "parent" ,
136139 help_text = "allows to group benchmarks in hierarchies" ,
137140 null = True , blank = True , default = None )
138141 benchmark_type = models .CharField (max_length = 1 , choices = B_TYPES , default = 'C' )
@@ -148,8 +151,9 @@ def __unicode__(self):
148151
149152 def clean (self ):
150153 if self .default_on_comparison and self .benchmark_type != 'C' :
151- raise ValidationError ("Only cross-project benchmarks are shown on the "
152- "comparison page. Deactivate 'default_on_comparison' first." )
154+ raise ValidationError ("Only cross-project benchmarks are shown "
155+ "on the comparison page. Deactivate "
156+ "'default_on_comparison' first." )
153157
154158
155159class Environment (models .Model ):
@@ -174,8 +178,6 @@ class Result(models.Model):
174178 benchmark = models .ForeignKey (Benchmark , related_name = "results" )
175179 environment = models .ForeignKey (Environment , related_name = "results" )
176180
177- # TODO: Add a benchmark version field
178-
179181 def __unicode__ (self ):
180182 return u"%s: %s" % (self .benchmark .name , self .value )
181183
@@ -208,7 +210,7 @@ def save(self, *args, **kwargs):
208210 change_threshold = 3.0
209211 trend_threshold = 5.0
210212 if (hasattr (settings , 'CHANGE_THRESHOLD' ) and
211- settings .CHANGE_THRESHOLD != None ):
213+ settings .CHANGE_THRESHOLD is not None ):
212214 change_threshold = settings .CHANGE_THRESHOLD
213215 if hasattr (settings , 'TREND_THRESHOLD' ) and settings .TREND_THRESHOLD :
214216 trend_threshold = settings .TREND_THRESHOLD
@@ -219,7 +221,8 @@ def save(self, *args, **kwargs):
219221 val = units ['totals' ]['change' ]
220222 if val == "-" :
221223 continue
222- color = self .getcolorcode (val , units ['lessisbetter' ], change_threshold )
224+ color = self .getcolorcode (val , units ['lessisbetter' ],
225+ change_threshold )
223226 if self .is_big_change (val , color , average_change , average_change_color ):
224227 # Do update biggest total change
225228 average_change = val
@@ -228,7 +231,8 @@ def save(self, *args, **kwargs):
228231 # Total trend
229232 val = units ['totals' ]['trend' ]
230233 if val != "-" :
231- color = self .getcolorcode (val , units ['lessisbetter' ], trend_threshold )
234+ color = self .getcolorcode (val , units ['lessisbetter' ],
235+ trend_threshold )
232236 if self .is_big_change (val , color , average_trend , average_trend_color ):
233237 # Do update biggest total trend change
234238 average_trend = val
@@ -239,7 +243,8 @@ def save(self, *args, **kwargs):
239243 val = row ['change' ]
240244 if val == "-" :
241245 continue
242- color = self .getcolorcode (val , units ['lessisbetter' ], change_threshold )
246+ color = self .getcolorcode (val , units ['lessisbetter' ],
247+ change_threshold )
243248 if self .is_big_change (val , color , max_change , max_change_color ):
244249 # Do update biggest single change
245250 max_change = val
@@ -287,7 +292,8 @@ def save(self, *args, **kwargs):
287292 and "yellow" or average_trend_color
288293 # Single benchmark trend
289294 if max_trend_color != "none" and self .colorcode != "red" :
290- if self .colorcode == "none" or (self .colorcode == "green" and "trend" not in self .summary ):
295+ if (self .colorcode == "none" or
296+ (self .colorcode == "green" and "trend" not in self .summary )):
291297 direction = max_trend >= 0 and "+" or ""
292298 self .summary = "%s trend %s%.1f%%" % (
293299 max_trend_ben , direction , round (max_trend , 1 ))
@@ -301,8 +307,8 @@ def is_big_change(self, val, color, current_val, current_color):
301307 return True
302308 elif color == "red" and abs (val ) > abs (current_val ):
303309 return True
304- elif color == "green" and current_color != "red" and \
305- abs (val ) > abs (current_val ):
310+ elif ( color == "green" and current_color != "red"
311+ and abs (val ) > abs (current_val ) ):
306312 return True
307313 else :
308314 return False
0 commit comments