Fixed flake8 errors.
This commit is contained in:
parent
1181b8a4a9
commit
b5a54168f9
|
@ -157,7 +157,7 @@ class MigrationAutodetector(object):
|
||||||
# Alright, there's a dependency on the same app.
|
# Alright, there's a dependency on the same app.
|
||||||
for j, op2 in enumerate(ops):
|
for j, op2 in enumerate(ops):
|
||||||
if self.check_dependency(op2, dep) and j > i:
|
if self.check_dependency(op2, dep) and j > i:
|
||||||
ops = ops[:i] + ops[i+1:j+1] + [op] + ops[j+1:]
|
ops = ops[:i] + ops[i + 1:j + 1] + [op] + ops[j + 1:]
|
||||||
found = True
|
found = True
|
||||||
break
|
break
|
||||||
if found:
|
if found:
|
||||||
|
@ -384,7 +384,7 @@ class MigrationAutodetector(object):
|
||||||
name=name,
|
name=name,
|
||||||
field=field,
|
field=field,
|
||||||
),
|
),
|
||||||
dependencies = [
|
dependencies=[
|
||||||
(dep_app_label, dep_object_name, None, True),
|
(dep_app_label, dep_object_name, None, True),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -396,7 +396,7 @@ class MigrationAutodetector(object):
|
||||||
name=model_name,
|
name=model_name,
|
||||||
unique_together=unique_together,
|
unique_together=unique_together,
|
||||||
),
|
),
|
||||||
dependencies = [
|
dependencies=[
|
||||||
(app_label, model_name, name, True)
|
(app_label, model_name, name, True)
|
||||||
for name, field in sorted(related_fields.items())
|
for name, field in sorted(related_fields.items())
|
||||||
]
|
]
|
||||||
|
@ -408,7 +408,7 @@ class MigrationAutodetector(object):
|
||||||
name=model_name,
|
name=model_name,
|
||||||
index_together=index_together,
|
index_together=index_together,
|
||||||
),
|
),
|
||||||
dependencies = [
|
dependencies=[
|
||||||
(app_label, model_name, name, True)
|
(app_label, model_name, name, True)
|
||||||
for name, field in sorted(related_fields.items())
|
for name, field in sorted(related_fields.items())
|
||||||
]
|
]
|
||||||
|
@ -499,7 +499,7 @@ class MigrationAutodetector(object):
|
||||||
operations.DeleteModel(
|
operations.DeleteModel(
|
||||||
name=model_state.name,
|
name=model_state.name,
|
||||||
),
|
),
|
||||||
dependencies = list(set(dependencies)),
|
dependencies=list(set(dependencies)),
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_added_fields(self):
|
def generate_added_fields(self):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class MigrationOptimizer(object):
|
||||||
for i, operation in enumerate(operations):
|
for i, operation in enumerate(operations):
|
||||||
# Compare it to each operation after it
|
# Compare it to each operation after it
|
||||||
for j, other in enumerate(operations[i + 1:]):
|
for j, other in enumerate(operations[i + 1:]):
|
||||||
result = self.reduce(operation, other, operations[i+1:i+j+1])
|
result = self.reduce(operation, other, operations[i + 1:i + j + 1])
|
||||||
if result is not None:
|
if result is not None:
|
||||||
# Optimize! Add result, then remaining others, then return
|
# Optimize! Add result, then remaining others, then return
|
||||||
new_operations.extend(result)
|
new_operations.extend(result)
|
||||||
|
|
Loading…
Reference in New Issue