unrelated: fix some warnings and redundant elements

This commit is contained in:
David-Wobrock authored and David Wobrock committed 2019-02-24 15:55:05 +01:00
1 parent 5c7dab8db2
commit 999ee2fa5e
3 files changed
+8 -7

No files matched your search

+2 -1
View File
@@ -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""):
+5 -5
View File
@@ -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"
+1 -1
View File
@@ -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):