From 1824410ac57d399a2ac17f4895a4087e148a8b91 Mon Sep 17 00:00:00 2001 From: David-Wobrock Date: Tue, 24 Nov 2020 22:40:28 +0100 Subject: [PATCH] Fix linting errors --- django_migration_linter/migration_linter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index e21cd7e..9a3d006 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -9,7 +9,7 @@ from subprocess import Popen, PIPE from django.conf import settings from django.core.management import call_command -from django.db import DEFAULT_DB_ALIAS, connections, ProgrammingError, connection +from django.db import DEFAULT_DB_ALIAS, connections, ProgrammingError from django.db.migrations import RunPython, RunSQL from enum import Enum, unique from six import PY2 @@ -524,7 +524,7 @@ class MigrationLinter(object): for model in called_models: has_same_model_name = ( re.search( - "{model}.*= +\w+?\.get_model\([^\)]+?\.{model}.*?\)".format( + r"{model}.*= +\w+?\.get_model\([^)]+?\.{model}.*?\)".format( model=model ), source_code, @@ -532,7 +532,7 @@ class MigrationLinter(object): ) is not None or re.search( - "{model}.*= +\w+?\.get_model\([^\)]+?,[^\)]*?{model}.*?\)".format( + r"{model}.*= +\w+?\.get_model\([^)]+?,[^)]*?{model}.*?\)".format( model=model ), source_code, @@ -546,7 +546,8 @@ class MigrationLinter(object): "code": "DATA_MIGRATION_MODEL_VARIABLE_NAME", "msg": ( "'{}': Model variable name {} is different from the " - "model class name that was found in the apps.get_model(...) call." + "model class name that was found in the " + "apps.get_model(...) call." ).format(function_name, model), } )