unrelated: fix some warnings and redundant elements
This commit is contained in:
1 parent
5c7dab8db2
commit
999ee2fa5e
3 files changed
+8
-7
No files matched your search
@@ -42,7 +42,8 @@ class Cache(dict):
|
|||||||
with open(self.filename, "wb") as f:
|
with open(self.filename, "wb") as f:
|
||||||
pickle.dump(self, f, protocol=2)
|
pickle.dump(self, f, protocol=2)
|
||||||
|
|
||||||
def md5(self, path):
|
@staticmethod
|
||||||
|
def md5(path):
|
||||||
hash_md5 = hashlib.md5()
|
hash_md5 = hashlib.md5()
|
||||||
with open(path, "rb") as f:
|
with open(path, "rb") as f:
|
||||||
for chunk in iter(lambda: f.read(4096), b""):
|
for chunk in iter(lambda: f.read(4096), b""):
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class MigrationLinter(object):
|
|||||||
)
|
)
|
||||||
if not is_django_project(project_path):
|
if not is_django_project(project_path):
|
||||||
raise ValueError(
|
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
|
project_path
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -168,7 +168,7 @@ class MigrationLinter(object):
|
|||||||
it allows to seperate the instances correctly.
|
it allows to seperate the instances correctly.
|
||||||
"""
|
"""
|
||||||
sqlmigrate_command = (
|
sqlmigrate_command = (
|
||||||
"cd {0} && {1} manage.py sqlmigrate {2} {3} " "--database {4}"
|
"cd {0} && {1} manage.py sqlmigrate {2} {3} --database {4}"
|
||||||
).format(
|
).format(
|
||||||
self.django_path, sys.executable, app_name, migration_name, self.database
|
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()):
|
for line in map(clean_bytes_to_str, diff_process.stdout.readlines()):
|
||||||
# Only gather lines that include added migrations
|
# Only gather lines that include added migrations
|
||||||
if (
|
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
|
and "__init__" not in line
|
||||||
):
|
):
|
||||||
migrations.append(Migration(os.path.join(self.django_path, line)))
|
migrations.append(Migration(os.path.join(self.django_path, line)))
|
||||||
@@ -289,7 +289,7 @@ def _main():
|
|||||||
type=str,
|
type=str,
|
||||||
nargs="?",
|
nargs="?",
|
||||||
help=(
|
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_group.add_argument(
|
||||||
"--cache-path",
|
"--cache-path",
|
||||||
type=str,
|
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(
|
cache_group.add_argument(
|
||||||
"--no-cache", action="store_true", help="don't use a cache"
|
"--no-cache", action="store_true", help="don't use a cache"
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ def split_migration_path(migration_path):
|
|||||||
decomposed_path = split_path(migration_path)
|
decomposed_path = split_path(migration_path)
|
||||||
for i, p in enumerate(decomposed_path):
|
for i, p in enumerate(decomposed_path):
|
||||||
if p == MIGRATION_FOLDER_NAME:
|
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):
|
def compose_migration_path(django_folder, app_name, migration):
|
||||||
|
|||||||
Reference in new issue
Block a user