Closes #18022: Extend linter (ruff) to enforce line length limit (120 chars) (#18067)

* Enable E501 rule
* Configure ruff formatter
* Reformat migration files to fix line length violations
* Fix various E501 errors
* Move table template code to template_code.py & ignore E501 errors
* Reformat raw SQL
This commit is contained in:
Jeremy Stretch
2024-11-21 15:58:11 -05:00
committed by GitHub
parent f08e36e538
commit 343a4af591
200 changed files with 5928 additions and 1670 deletions

View File

@@ -93,9 +93,14 @@ class ManagedFile(SyncedDataMixin, models.Model):
self.file_path = os.path.basename(self.data_path)
# Ensure that the file root and path make a unique pair
if self._meta.model.objects.filter(file_root=self.file_root, file_path=self.file_path).exclude(pk=self.pk).exists():
if self._meta.model.objects.filter(
file_root=self.file_root, file_path=self.file_path
).exclude(pk=self.pk).exists():
raise ValidationError(
f"A {self._meta.verbose_name.lower()} with this file path already exists ({self.file_root}/{self.file_path}).")
_("A {model} with this file path already exists ({path}).").format(
model=self._meta.verbose_name.lower(),
path=f"{self.file_root}/{self.file_path}"
))
def delete(self, *args, **kwargs):
# Delete file from disk

View File

@@ -203,7 +203,17 @@ class Job(models.Model):
job_end.send(self)
@classmethod
def enqueue(cls, func, instance=None, name='', user=None, schedule_at=None, interval=None, immediate=False, **kwargs):
def enqueue(
cls,
func,
instance=None,
name='',
user=None,
schedule_at=None,
interval=None,
immediate=False,
**kwargs
):
"""
Create a Job instance and enqueue a job using the given callable