@@ -138,7 +138,9 @@ def waiting_to_update_queue(self, applications, collection):
138138
139139 def waiting_to_end_queue (self , applications , collection ):
140140 return self .for_collection (
141- self .filter (NimbusExperiment .Filters .IS_ENDING , application__in = applications ),
141+ self .filter (
142+ NimbusExperiment .Filters .IS_ENDING , application__in = applications
143+ ),
142144 collection ,
143145 )
144146
@@ -172,11 +174,15 @@ class Meta:
172174 unique_together = ("parent_experiment" , "child_experiment" , "branch_slug" )
173175
174176
175- class NimbusExperimentBranchThroughRequired (NimbusExperimentBranchThrough ): # noqa: DJ008
177+ class NimbusExperimentBranchThroughRequired (
178+ NimbusExperimentBranchThrough
179+ ): # noqa: DJ008
176180 pass
177181
178182
179- class NimbusExperimentBranchThroughExcluded (NimbusExperimentBranchThrough ): # noqa: DJ008
183+ class NimbusExperimentBranchThroughExcluded (
184+ NimbusExperimentBranchThrough
185+ ): # noqa: DJ008
180186 pass
181187
182188
@@ -409,7 +415,9 @@ def default_firefox_version_parsed():
409415 # Cached dates
410416 _updated_date_time = models .DateTimeField (auto_now = True )
411417 _start_date = models .DateField ("Start Date" , blank = True , null = True )
412- _enrollment_end_date = models .DateField ("Enrollment End Date" , blank = True , null = True )
418+ _enrollment_end_date = models .DateField (
419+ "Enrollment End Date" , blank = True , null = True
420+ )
413421 _computed_end_date = models .DateField ("Computed End Date" , blank = True , null = True )
414422 _end_date = models .DateField ("End Date" , blank = True , null = True )
415423
@@ -961,7 +969,9 @@ def should_show_timeout_message(self):
961969 def should_show_end_enrollment (self ):
962970 # If these conditions change then you must update
963971 # `LiveToEndEnrollmentForm.clean`.
964- return self .is_enrolling and (not self .is_rollout or self .is_firefox_labs_opt_in )
972+ return self .is_enrolling and (
973+ not self .is_rollout or self .is_firefox_labs_opt_in
974+ )
965975
966976 @property
967977 def should_show_end_experiment (self ):
@@ -1016,7 +1026,8 @@ def preview_date(self):
10161026 def review_date (self ):
10171027 if change := (
10181028 self .changes .filter (
1019- new_status = self .Status .DRAFT , new_publish_status = self .PublishStatus .REVIEW
1029+ new_status = self .Status .DRAFT ,
1030+ new_publish_status = self .PublishStatus .REVIEW ,
10201031 )
10211032 .order_by ("changed_on" )
10221033 .first ()
@@ -1079,7 +1090,10 @@ def days_since_enrollment_start(self):
10791090
10801091 @property
10811092 def enrollment_percent_completion (self ):
1082- if self .days_since_enrollment_start is not None and self .computed_enrollment_days :
1093+ if (
1094+ self .days_since_enrollment_start is not None
1095+ and self .computed_enrollment_days
1096+ ):
10831097 percent = (
10841098 self .days_since_enrollment_start / self .computed_enrollment_days
10851099 ) * 100
@@ -1117,11 +1131,16 @@ def proposed_enrollment_end_date(self):
11171131
11181132 @property
11191133 def proposed_end_date (self ):
1120- if self .proposed_duration is not None and self .enrollment_start_date is not None :
1134+ if (
1135+ self .proposed_duration is not None
1136+ and self .enrollment_start_date is not None
1137+ ):
11211138 proposed_observation_duration = (
11221139 self .proposed_duration - self .proposed_enrollment
11231140 )
1124- total_duration = self .computed_enrollment_days + proposed_observation_duration
1141+ total_duration = (
1142+ self .computed_enrollment_days + proposed_observation_duration
1143+ )
11251144 return self .enrollment_start_date + datetime .timedelta (days = total_duration )
11261145
11271146 @property
@@ -1180,7 +1199,10 @@ def computed_end_date(self):
11801199 return None
11811200
11821201 if self ._computed_end_date :
1183- if self .start_date is not None and self ._computed_end_date >= self .start_date :
1202+ if (
1203+ self .start_date is not None
1204+ and self ._computed_end_date >= self .start_date
1205+ ):
11841206 return self ._computed_end_date
11851207
11861208 end_date = self ._get_computed_end_date ()
@@ -1428,7 +1450,9 @@ def is_ready_for_attention(self):
14281450 return (
14291451 self .is_review
14301452 or self .is_missing_takeaway_info
1431- or (not self .is_complete and (self .should_end_enrollment or self .should_end ))
1453+ or (
1454+ not self .is_complete and (self .should_end_enrollment or self .should_end )
1455+ )
14321456 )
14331457
14341458 @property
@@ -1455,7 +1479,9 @@ def monitoring_summary(self):
14551479 total_enrollments = self .monitoring_data .get ("total_enrollments" , 0 )
14561480 total_unenrollments = self .monitoring_data .get ("total_unenrollments" , 0 )
14571481 unenrollment_rate = (
1458- (total_unenrollments / total_enrollments ) * 100 if total_enrollments else 0.0
1482+ (total_unenrollments / total_enrollments ) * 100
1483+ if total_enrollments
1484+ else 0.0
14591485 )
14601486
14611487 reasons_by_branch = self .monitoring_data .get ("reasons_by_branch" , {})
@@ -1535,7 +1561,9 @@ def rollout_monitoring_dashboard_url(self):
15351561 or (
15361562 self .end_date
15371563 > datetime .date .today ()
1538- - datetime .timedelta (days = settings .ROLLOUT_MONITORING_EXPIRATION_DAYS )
1564+ - datetime .timedelta (
1565+ days = settings .ROLLOUT_MONITORING_EXPIRATION_DAYS
1566+ )
15391567 )
15401568 )
15411569 ):
@@ -1649,7 +1677,9 @@ def allocate_bucket_range(self):
16491677 self .bucket_namespace ,
16501678 self ,
16511679 int (
1652- self .population_percent / Decimal ("100.0" ) * NimbusExperiment .BUCKET_TOTAL
1680+ self .population_percent
1681+ / Decimal ("100.0" )
1682+ * NimbusExperiment .BUCKET_TOTAL
16531683 ),
16541684 )
16551685
@@ -2147,7 +2177,9 @@ def rollout_version_warning(self):
21472177 )
21482178
21492179 parsed_required_version = NimbusExperiment .Version .parse (min_required_version )
2150- parsed_current_version = NimbusExperiment .Version .parse (self .firefox_min_version )
2180+ parsed_current_version = NimbusExperiment .Version .parse (
2181+ self .firefox_min_version
2182+ )
21512183
21522184 if parsed_current_version < parsed_required_version :
21532185 return {
@@ -2322,7 +2354,9 @@ def clone(self, name, user, rollout_branch_slug=None, changed_on=None):
23222354
23232355 for (
23242356 required_experiment_branch
2325- ) in NimbusExperimentBranchThroughRequired .objects .filter (parent_experiment = self ):
2357+ ) in NimbusExperimentBranchThroughRequired .objects .filter (
2358+ parent_experiment = self
2359+ ):
23262360 NimbusExperimentBranchThroughRequired .objects .create (
23272361 parent_experiment = cloned ,
23282362 child_experiment = required_experiment_branch .child_experiment ,
@@ -2331,7 +2365,9 @@ def clone(self, name, user, rollout_branch_slug=None, changed_on=None):
23312365
23322366 for (
23332367 excluded_experiment_branch
2334- ) in NimbusExperimentBranchThroughExcluded .objects .filter (parent_experiment = self ):
2368+ ) in NimbusExperimentBranchThroughExcluded .objects .filter (
2369+ parent_experiment = self
2370+ ):
23352371 NimbusExperimentBranchThroughExcluded .objects .create (
23362372 parent_experiment = cloned ,
23372373 child_experiment = excluded_experiment_branch .child_experiment ,
@@ -2455,7 +2491,9 @@ def conclusion_recommendation_labels(self):
24552491
24562492 @property
24572493 def recipe_json (self ):
2458- from experimenter .experiments .api .v6 .serializers import NimbusExperimentSerializer
2494+ from experimenter .experiments .api .v6 .serializers import (
2495+ NimbusExperimentSerializer ,
2496+ )
24592497
24602498 return json .dumps (
24612499 self .published_dto or NimbusExperimentSerializer (self ).data ,
@@ -2842,7 +2880,9 @@ def get_versioned_schema_range(
28422880 if min_supported_version := NimbusConstants .MIN_VERSIONED_FEATURE_VERSION .get (
28432881 self .application
28442882 ):
2845- min_supported_version = NimbusExperiment .Version .parse (min_supported_version )
2883+ min_supported_version = NimbusExperiment .Version .parse (
2884+ min_supported_version
2885+ )
28462886
28472887 if min_supported_version > min_version :
28482888 if max_version is not None and min_supported_version > max_version :
@@ -2979,7 +3019,11 @@ def prefixed(**kwargs: dict[str, Any]):
29793019 Q (** prefixed (major = max_version .major ))
29803020 & (
29813021 Q (** prefixed (minor__lt = max_version .minor ))
2982- | Q (** prefixed (minor = max_version .minor , patch__lte = max_version .micro ))
3022+ | Q (
3023+ ** prefixed (
3024+ minor = max_version .minor , patch__lte = max_version .micro
3025+ )
3026+ )
29833027 )
29843028 )
29853029
@@ -3012,7 +3056,9 @@ class NimbusVersionedSchemaManager(models.Manager["NimbusVersionedSchema"]):
30123056 def with_version_ordering (self , descending = False ):
30133057 """Order schemas by semantic version (major.minor.patch)."""
30143058 if descending :
3015- return self .order_by ("-version__major" , "-version__minor" , "-version__patch" )
3059+ return self .order_by (
3060+ "-version__major" , "-version__minor" , "-version__patch"
3061+ )
30163062 return self .order_by ("version__major" , "version__minor" , "version__patch" )
30173063
30183064
@@ -3111,7 +3157,9 @@ def current_datetime():
31113157 null = True ,
31123158 choices = NimbusExperiment .PublishStatus .choices ,
31133159 )
3114- new_status = models .CharField (max_length = 255 , choices = NimbusExperiment .Status .choices )
3160+ new_status = models .CharField (
3161+ max_length = 255 , choices = NimbusExperiment .Status .choices
3162+ )
31153163 new_status_next = models .CharField (
31163164 max_length = 255 , blank = True , null = True , choices = NimbusExperiment .Status .choices
31173165 )
@@ -3229,7 +3277,9 @@ class NimbusAlert(models.Model):
32293277 help_text = "Category of alert" ,
32303278 )
32313279 message = models .TextField (help_text = "Alert message text sent to Slack" )
3232- sent_on = models .DateTimeField (auto_now_add = True , help_text = "When the alert was sent" )
3280+ sent_on = models .DateTimeField (
3281+ auto_now_add = True , help_text = "When the alert was sent"
3282+ )
32333283 slack_thread_id = models .CharField (
32343284 max_length = 255 ,
32353285 null = True ,
0 commit comments