@@ -317,9 +317,7 @@ def check_s3(self) -> Tuple[str, int]:
317
317
endpoint_url = settings .S3_ENDPOINT_URL ,
318
318
region_name = settings .HMRC_PACKAGING_S3_REGION_NAME ,
319
319
)
320
- client .head_bucket (
321
- Bucket = settings .HMRC_PACKAGING_STORAGE_BUCKET_NAME ,
322
- )
320
+ client .head_bucket (Bucket = settings .HMRC_PACKAGING_STORAGE_BUCKET_NAME )
323
321
return "OK" , 200
324
322
except (ClientError , EndpointConnectionError ):
325
323
return "S3 health check failed" , 503
@@ -441,14 +439,10 @@ def get_context_data(self, **kwargs):
441
439
data ["APP_UPDATED_TIME" ] = AppInfoView .timestamp_to_datetime_string (
442
440
os .path .getmtime (__file__ ),
443
441
)
444
- last_transaction = Transaction .objects .order_by (
445
- "updated_at" ,
446
- ).last ()
442
+ last_transaction = Transaction .objects .order_by ("updated_at" ).last ()
447
443
data ["LAST_TRANSACTION_TIME" ] = (
448
444
format (
449
- last_transaction .updated_at .strftime (
450
- AppInfoView .DATETIME_FORMAT ,
451
- ),
445
+ last_transaction .updated_at .strftime (AppInfoView .DATETIME_FORMAT ),
452
446
)
453
447
if last_transaction
454
448
else "No transactions"
@@ -535,9 +529,7 @@ def get_object(self, queryset: Optional[QuerySet] = None) -> Model:
535
529
try :
536
530
obj = queryset .get ()
537
531
except queryset .model .DoesNotExist :
538
- raise Http404 (
539
- f"No { self .model .__name__ } matching the query { self .kwargs } " ,
540
- )
532
+ raise Http404 (f"No { self .model .__name__ } matching the query { self .kwargs } " )
541
533
542
534
return obj
543
535
@@ -670,15 +662,10 @@ def get_ordering(self):
670
662
self ,
671
663
"sort_by_fields" ,
672
664
), "SortingMixin requires class attribute sort_by_fields to be set"
673
- assert isinstance (
674
- self .sort_by_fields ,
675
- list ,
676
- ), "sort_by_fields must be a list"
665
+ assert isinstance (self .sort_by_fields , list ), "sort_by_fields must be a list"
677
666
678
667
if sort_by and sort_by in self .sort_by_fields :
679
- if hasattr (self , "custom_sorting" ) and self .custom_sorting .get (
680
- sort_by ,
681
- ):
668
+ if hasattr (self , "custom_sorting" ) and self .custom_sorting .get (sort_by ):
682
669
sort_by = self .custom_sorting .get (sort_by )
683
670
684
671
if ordered == "desc" :
@@ -691,19 +678,11 @@ def get_ordering(self):
691
678
692
679
693
680
def handler403 (request , * args , ** kwargs ):
694
- return TemplateResponse (
695
- request = request ,
696
- template = "common/403.jinja" ,
697
- status = 403 ,
698
- )
681
+ return TemplateResponse (request = request , template = "common/403.jinja" , status = 403 )
699
682
700
683
701
684
def handler500 (request , * args , ** kwargs ):
702
- return TemplateResponse (
703
- request = request ,
704
- template = "common/500.jinja" ,
705
- status = 500 ,
706
- )
685
+ return TemplateResponse (request = request , template = "common/500.jinja" , status = 500 )
707
686
708
687
709
688
class MaintenanceView (TemplateView ):
0 commit comments