chore: Upgrade Python syntax with pyupgrade

Run with the following pre-commit configuration:

```
repos:
  - repo: https://github.com/asottile/pyupgrade
    rev: v3.1.0
    hooks:
      - id: pyupgrade
        args: [ "--py3-plus", "--py36-plus", "--py37-plus" ]
```

The rationale for every change can be found at https://github.com/asottile/pyupgrade
This commit is contained in:
Sondre Lillebø Gundersen authored and David Wobrock committed 2022-11-03 22:00:00 +01:00
1 parent 92eab3c929
commit bd4eb89b8c
29 files changed
+32 -65

No files matched your search

+2 -2
View File
@@ -8,7 +8,7 @@ from django_migration_linter import MigrationLinter
from tests import fixtures
class BaseBackwardCompatibilityDetection(object):
class BaseBackwardCompatibilityDetection:
def setUp(self, *args, **kwargs):
self.database = next(iter(self.databases))
self.test_project_path = os.path.dirname(settings.BASE_DIR)
@@ -24,7 +24,7 @@ class BaseBackwardCompatibilityDetection(object):
"app_unique_together",
database=self.database,
)
return super(BaseBackwardCompatibilityDetection, self).setUp(*args, **kwargs)
return super().setUp(*args, **kwargs)
def _test_linter_finds_errors(self, app=None, commit_id=None):
linter = self._launch_linter(app, commit_id)
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:54
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:55
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:56
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:56
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:59
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:59
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:59
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 14:59
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
# class A(models.Model):
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:02
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:02
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:00
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:00
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from django.db import models
+2 -2
View File
@@ -19,10 +19,10 @@ class SqlAnalyserTestCase(unittest.TestCase):
def assertValidSql(self, sql, allow_warnings=False):
errors, _, warnings = self.analyse_sql(sql)
self.assertEqual(0, len(errors), "Found errors in sql: {}".format(errors))
self.assertEqual(0, len(errors), f"Found errors in sql: {errors}")
if not allow_warnings:
self.assertEqual(
0, len(warnings), "Found warnings in sql: {}".format(errors)
0, len(warnings), f"Found warnings in sql: {errors}"
)
def assertBackwardIncompatibleSql(self, sql, code=None):