Run black.

This commit is contained in:
David Wobrock authored and David Wobrock committed 2022-11-03 22:00:00 +01:00
1 parent a9405eaf83
commit e8f83708b0
4 files changed
+6 -12

No files matched your search

+3 -5
View File
@@ -301,9 +301,7 @@ class MigrationLinter:
return self.nb_erroneous > 0
def get_sql(self, app_label, migration_name):
logger.info(
f"Calling sqlmigrate command {app_label} {migration_name}"
)
logger.info(f"Calling sqlmigrate command {app_label} {migration_name}")
dev_null = open(os.devnull, "w")
try:
sql_statement = call_command(
@@ -327,7 +325,7 @@ class MigrationLinter:
from django.db.migrations.loader import MIGRATIONS_MODULE_NAME
return (
re.search(fr"/{MIGRATIONS_MODULE_NAME}/.*\.py", filename)
re.search(rf"/{MIGRATIONS_MODULE_NAME}/.*\.py", filename)
and "__init__" not in filename
)
@@ -537,7 +535,7 @@ class MigrationLinter:
model = model.split(".", 1)[0]
has_get_model_call = (
re.search(
fr"{model}.*= +\w+\.get_model\(",
rf"{model}.*= +\w+\.get_model\(",
source_code,
)
is not None
+1 -2
View File
@@ -36,8 +36,7 @@ def has_add_unique(sql_statements, **kwargs):
concerned_table = regex_result.group(1)
table_is_added_in_transaction = any(
sql.startswith(f"CREATE TABLE {concerned_table}")
for sql in sql_statements
sql.startswith(f"CREATE TABLE {concerned_table}") for sql in sql_statements
)
return not table_is_added_in_transaction
@@ -16,8 +16,7 @@ def has_create_index(sql_statements, **kwargs):
concerned_table = regex_result.group(2)
table_is_added_in_transaction = any(
sql.startswith(f"CREATE TABLE {concerned_table}")
for sql in sql_statements
sql.startswith(f"CREATE TABLE {concerned_table}") for sql in sql_statements
)
return not table_is_added_in_transaction
+1 -3
View File
@@ -21,9 +21,7 @@ class SqlAnalyserTestCase(unittest.TestCase):
errors, _, warnings = self.analyse_sql(sql)
self.assertEqual(0, len(errors), f"Found errors in sql: {errors}")
if not allow_warnings:
self.assertEqual(
0, len(warnings), f"Found warnings in sql: {errors}"
)
self.assertEqual(0, len(warnings), f"Found warnings in sql: {errors}")
def assertBackwardIncompatibleSql(self, sql, code=None):
errors, _, _ = self.analyse_sql(sql)