diff --git a/netbox/core/models/jobs.py b/netbox/core/models/jobs.py index 63ce4ed14..2e3425129 100644 --- a/netbox/core/models/jobs.py +++ b/netbox/core/models/jobs.py @@ -181,7 +181,11 @@ class Job(models.Model): """ valid_statuses = JobStatusChoices.TERMINAL_STATE_CHOICES if status not in valid_statuses: - raise ValueError(_("Invalid status for job termination. Choices are: {choices}").format(choices=', '.join(valid_statuses))) + raise ValueError( + _("Invalid status for job termination. Choices are: {choices}").format( + choices=', '.join(valid_statuses) + ) + ) # Mark the job as completed self.status = status diff --git a/netbox/extras/conditions.py b/netbox/extras/conditions.py index b715f00f0..39005b752 100644 --- a/netbox/extras/conditions.py +++ b/netbox/extras/conditions.py @@ -143,7 +143,8 @@ class ConditionSet: logic = list(ruleset.keys())[0] if type(logic) is not str or logic.lower() not in (AND, OR): raise ValueError(_("Invalid logic type: {logic} (must be '{op_and}' or '{op_or}')").format( - logic=logic, op_and=AND, op_or=OR)) + logic=logic, op_and=AND, op_or=OR + )) self.logic = logic.lower() # Compile the set of Conditions diff --git a/netbox/netbox/api/serializers/nested.py b/netbox/netbox/api/serializers/nested.py index d70890181..027f3d11e 100644 --- a/netbox/netbox/api/serializers/nested.py +++ b/netbox/netbox/api/serializers/nested.py @@ -34,7 +34,9 @@ class WritableNestedSerializer(BaseModelSerializer): raise ValidationError( _("Related object not found using the provided attributes: {params}").format(params=params)) except MultipleObjectsReturned: - raise ValidationError(_("Multiple objects match the provided attributes: {params}").format(params=params)) + raise ValidationError( + _("Multiple objects match the provided attributes: {params}").format(params=params) + ) except FieldError as e: raise ValidationError(e) @@ -44,7 +46,10 @@ class WritableNestedSerializer(BaseModelSerializer): pk = int(data) except (TypeError, ValueError): raise ValidationError( - _("Related objects must be referenced by numeric ID or by dictionary of attributes. Received an unrecognized value: {value}").format(value=data) + _( + "Related objects must be referenced by numeric ID or by dictionary of attributes. Received an " + "unrecognized value: {value}" + ).format(value=data) ) # Look up object by PK diff --git a/netbox/utilities/forms/utils.py b/netbox/utilities/forms/utils.py index 0ed2f703c..abd367be5 100644 --- a/netbox/utilities/forms/utils.py +++ b/netbox/utilities/forms/utils.py @@ -238,7 +238,7 @@ def parse_csv(reader): if len(row) != len(headers): raise forms.ValidationError( _("Row {i}: Expected {count_expected} columns but found {count_found}").format( - count_expected=len(headers), len_row=len(count_found) + count_expected=len(headers), count_found=len(row) ) ) row = [col.strip() for col in row] diff --git a/netbox/utilities/views.py b/netbox/utilities/views.py index f01477b07..9c89de998 100644 --- a/netbox/utilities/views.py +++ b/netbox/utilities/views.py @@ -95,8 +95,8 @@ class ObjectPermissionRequiredMixin(AccessMixin): if not hasattr(self, 'queryset'): raise ImproperlyConfigured( _( - '{class_name} has no queryset defined. ObjectPermissionRequiredMixin may only be used on views which ' - 'define a base queryset' + '{class_name} has no queryset defined. ObjectPermissionRequiredMixin may only be used on views ' + 'which define a base queryset' ).format(class_name=self.__class__.__name__) )