diff --git a/django_migration_linter/cache.py b/django_migration_linter/cache.py index 892e2df..aa28578 100644 --- a/django_migration_linter/cache.py +++ b/django_migration_linter/cache.py @@ -42,7 +42,8 @@ class Cache(dict): with open(self.filename, "wb") as f: pickle.dump(self, f, protocol=2) - def md5(self, path): + @staticmethod + def md5(path): hash_md5 = hashlib.md5() with open(path, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): diff --git a/django_migration_linter/migration_linter.py b/django_migration_linter/migration_linter.py index d403ffe..2b557ca 100644 --- a/django_migration_linter/migration_linter.py +++ b/django_migration_linter/migration_linter.py @@ -39,7 +39,7 @@ class MigrationLinter(object): ) if not is_django_project(project_path): raise ValueError( - ("The given path {0} does not " "seem to be a django project.").format( + "The given path {0} does not seem to be a django project.".format( project_path ) ) @@ -168,7 +168,7 @@ class MigrationLinter(object): it allows to seperate the instances correctly. """ sqlmigrate_command = ( - "cd {0} && {1} manage.py sqlmigrate {2} {3} " "--database {4}" + "cd {0} && {1} manage.py sqlmigrate {2} {3} --database {4}" ).format( self.django_path, sys.executable, app_name, migration_name, self.database ) @@ -200,7 +200,7 @@ class MigrationLinter(object): for line in map(clean_bytes_to_str, diff_process.stdout.readlines()): # Only gather lines that include added migrations if ( - re.search(r"\/{0}\/.*\.py".format(MIGRATION_FOLDER_NAME), line) + re.search(r"/{0}/.*\.py".format(MIGRATION_FOLDER_NAME), line) and "__init__" not in line ): migrations.append(Migration(os.path.join(self.django_path, line))) @@ -289,7 +289,7 @@ def _main(): type=str, nargs="?", help=( - "specify the database for which to generate the SQL. " "Defaults to default" + "specify the database for which to generate the SQL. Defaults to default" ), ) @@ -297,7 +297,7 @@ def _main(): cache_group.add_argument( "--cache-path", type=str, - help="specify a directory that should be used to" "store cache-files in.", + help="specify a directory that should be used to store cache-files in.", ) cache_group.add_argument( "--no-cache", action="store_true", help="don't use a cache" diff --git a/django_migration_linter/utils.py b/django_migration_linter/utils.py index e4cddbc..b398f76 100644 --- a/django_migration_linter/utils.py +++ b/django_migration_linter/utils.py @@ -70,7 +70,7 @@ def split_migration_path(migration_path): decomposed_path = split_path(migration_path) for i, p in enumerate(decomposed_path): if p == MIGRATION_FOLDER_NAME: - return (decomposed_path[i - 1], os.path.splitext(decomposed_path[i + 1])[0]) + return decomposed_path[i - 1], os.path.splitext(decomposed_path[i + 1])[0] def compose_migration_path(django_folder, app_name, migration):