Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

flake8 fixes

  • Loading branch information...
commit e5b7045422d8e02de8aa05a69f689fa91fcbbeba 1 parent f16abe4
@alex alex authored
View
2  django/db/migrations/operations/base.py
@@ -10,7 +10,7 @@ class Operation(object):
copying operations), and some will need their modifications to be
optionally specified by the user (e.g. custom Python code snippets)
- Due to the way this class deals with deconstruction, it should be
+ Due to the way this class deals with deconstruction, it should be
considered immutable.
"""
View
2  django/db/migrations/operations/fields.py
@@ -171,5 +171,5 @@ def references_model(self, name, app_label=None):
def references_field(self, model_name, name, app_label=None):
return self.references_model(model_name) and (
name.lower() == self.old_name.lower() or
- name.lower() == self.new_name.lower()
+ name.lower() == self.new_name.lower()
)
View
48 django/db/migrations/optimizer.py
@@ -178,9 +178,9 @@ def reduce_model_create_rename(self, operation, other):
if operation.name.lower() == other.old_name.lower():
return [migrations.CreateModel(
other.new_name,
- fields = operation.fields,
- options = operation.options,
- bases = operation.bases,
+ fields=operation.fields,
+ options=operation.options,
+ bases=operation.bases,
)]
def reduce_model_rename_self(self, operation, other):
@@ -199,54 +199,54 @@ def reduce_create_model_add_field(self, operation, other):
if operation.name.lower() == other.model_name.lower():
return [migrations.CreateModel(
operation.name,
- fields = operation.fields + [(other.name, other.field)],
- options = operation.options,
- bases = operation.bases,
+ fields=operation.fields + [(other.name, other.field)],
+ options=operation.options,
+ bases=operation.bases,
)]
def reduce_create_model_alter_field(self, operation, other):
if operation.name.lower() == other.model_name.lower():
return [migrations.CreateModel(
operation.name,
- fields = [
+ fields=[
(n, other.field if n == other.name else v)
for n, v in operation.fields
],
- options = operation.options,
- bases = operation.bases,
+ options=operation.options,
+ bases=operation.bases,
)]
def reduce_create_model_rename_field(self, operation, other):
if operation.name.lower() == other.model_name.lower():
return [migrations.CreateModel(
operation.name,
- fields = [
+ fields=[
(other.new_name if n == other.old_name else n, v)
for n, v in operation.fields
],
- options = operation.options,
- bases = operation.bases,
+ options=operation.options,
+ bases=operation.bases,
)]
def reduce_create_model_remove_field(self, operation, other):
if operation.name.lower() == other.model_name.lower():
return [migrations.CreateModel(
operation.name,
- fields = [
+ fields=[
(n, v)
for n, v in operation.fields
if n.lower() != other.name.lower()
],
- options = operation.options,
- bases = operation.bases,
+ options=operation.options,
+ bases=operation.bases,
)]
def reduce_add_field_alter_field(self, operation, other):
if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.name.lower():
return [migrations.AddField(
- model_name = operation.model_name,
- name = operation.name,
- field = other.field,
+ model_name=operation.model_name,
+ name=operation.name,
+ field=other.field,
)]
def reduce_add_field_delete_field(self, operation, other):
@@ -260,9 +260,9 @@ def reduce_alter_field_delete_field(self, operation, other):
def reduce_add_field_rename_field(self, operation, other):
if operation.model_name.lower() == other.model_name.lower() and operation.name.lower() == other.old_name.lower():
return [migrations.AddField(
- model_name = operation.model_name,
- name = other.new_name,
- field = operation.field,
+ model_name=operation.model_name,
+ name=other.new_name,
+ field=operation.field,
)]
def reduce_alter_field_rename_field(self, operation, other):
@@ -270,9 +270,9 @@ def reduce_alter_field_rename_field(self, operation, other):
return [
other,
migrations.AlterField(
- model_name = operation.model_name,
- name = other.new_name,
- field = operation.field,
+ model_name=operation.model_name,
+ name=other.new_name,
+ field=operation.field,
),
]
View
2  django/utils/translation/trans_real.py
@@ -49,7 +49,7 @@
language_code_prefix_re = re.compile(r'^/([\w-]+)(/|$)')
# some browsers use deprecated locales. refs #18419
-_BROWSERS_DEPRECATED_LOCALES = {
+_BROWSERS_DEPRECATED_LOCALES = {
'zh-cn': 'zh-hans',
'zh-tw': 'zh-hant',
}
View
4 tests/migrations/test_optimizer.py
@@ -1,5 +1,5 @@
# encoding: utf8
-import operator
+
from django.test import TestCase
from django.db.migrations.optimizer import MigrationOptimizer
from django.db import migrations
@@ -65,7 +65,7 @@ def test_single(self):
self.assertOptimizesTo(
[migrations.DeleteModel("Foo")],
[migrations.DeleteModel("Foo")],
- exact = 1,
+ exact=1,
)
def test_create_delete_model(self):
Please sign in to comment.
Something went wrong with that request. Please try again.