summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorPiotr Jakimiak <pj306228@students.mimuw.edu.pl>2015-05-13 20:51:18 +0200
committerPiotr Jakimiak <pj306228@students.mimuw.edu.pl>2015-05-13 20:51:18 +0200
commit4157c502a5202798d0f73645181cb82aa71d34d9 (patch)
tree78c99c7fd271f6c25a71b2ccf781ab7928396677 /django/db
parentf61c4f490dc4c8ec6ba94ad4f40247db2425fc3e (diff)
Removed unnecessary arguments in .get method calls
Diffstat (limited to 'django/db')
-rw-r--r--django/db/migrations/autodetector.py14
-rw-r--r--django/db/models/fields/__init__.py8
-rw-r--r--django/db/models/fields/files.py2
-rw-r--r--django/db/models/query.py2
4 files changed, 13 insertions, 13 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index a73985d724..ad6aeda380 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -591,7 +591,7 @@ class MigrationAutodetector(object):
added = set(self.new_proxy_keys) - set(self.old_proxy_keys)
for app_label, model_name in sorted(added):
model_state = self.to_state.models[app_label, model_name]
- assert model_state.options.get("proxy", False)
+ assert model_state.options.get("proxy")
# Depend on the deletion of any possible non-proxy version of us
dependencies = [
(app_label, model_name, None, False),
@@ -695,7 +695,7 @@ class MigrationAutodetector(object):
for name, field in sorted(related_fields.items()):
dependencies.append((app_label, model_name, name, False))
# We're referenced in another field's through=
- through_user = self.through_users.get((app_label, model_state.name_lower), None)
+ through_user = self.through_users.get((app_label, model_state.name_lower))
if through_user:
dependencies.append((through_user[0], through_user[1], through_user[2], False))
# Finally, make the operation, deduping any dependencies
@@ -714,7 +714,7 @@ class MigrationAutodetector(object):
deleted = set(self.old_proxy_keys) - set(self.new_proxy_keys)
for app_label, model_name in sorted(deleted):
model_state = self.from_state.models[app_label, model_name]
- assert model_state.options.get("proxy", False)
+ assert model_state.options.get("proxy")
self.add_operation(
app_label,
operations.DeleteModel(
@@ -980,12 +980,12 @@ class MigrationAutodetector(object):
old_model_name = self.renamed_models.get((app_label, model_name), model_name)
old_model_state = self.from_state.models[app_label, old_model_name]
new_model_state = self.to_state.models[app_label, model_name]
- if (old_model_state.options.get("order_with_respect_to", None) !=
- new_model_state.options.get("order_with_respect_to", None)):
+ if (old_model_state.options.get("order_with_respect_to") !=
+ new_model_state.options.get("order_with_respect_to")):
# Make sure it comes second if we're adding
# (removal dependency is part of RemoveField)
dependencies = []
- if new_model_state.options.get("order_with_respect_to", None):
+ if new_model_state.options.get("order_with_respect_to"):
dependencies.append((
app_label,
model_name,
@@ -997,7 +997,7 @@ class MigrationAutodetector(object):
app_label,
operations.AlterOrderWithRespectTo(
name=model_name,
- order_with_respect_to=new_model_state.options.get('order_with_respect_to', None),
+ order_with_respect_to=new_model_state.options.get('order_with_respect_to'),
),
dependencies=dependencies,
)
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 98594b6127..78e74b7850 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1739,7 +1739,7 @@ class FilePathField(Field):
kwargs['allow_files'] = self.allow_files
if self.allow_folders is not False:
kwargs['allow_folders'] = self.allow_folders
- if kwargs.get("max_length", None) == 100:
+ if kwargs.get("max_length") == 100:
del kwargs["max_length"]
return name, path, args, kwargs
@@ -1955,7 +1955,7 @@ class GenericIPAddressField(Field):
kwargs['unpack_ipv4'] = self.unpack_ipv4
if self.protocol != "both":
kwargs['protocol'] = self.protocol
- if kwargs.get("max_length", None) == 39:
+ if kwargs.get("max_length") == 39:
del kwargs['max_length']
return name, path, args, kwargs
@@ -2099,7 +2099,7 @@ class SlugField(CharField):
def deconstruct(self):
name, path, args, kwargs = super(SlugField, self).deconstruct()
- if kwargs.get("max_length", None) == 50:
+ if kwargs.get("max_length") == 50:
del kwargs['max_length']
if self.db_index is False:
kwargs['db_index'] = False
@@ -2288,7 +2288,7 @@ class URLField(CharField):
def deconstruct(self):
name, path, args, kwargs = super(URLField, self).deconstruct()
- if kwargs.get("max_length", None) == 200:
+ if kwargs.get("max_length") == 200:
del kwargs['max_length']
return name, path, args, kwargs
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index 2363088a6e..3f4c7064e4 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -282,7 +282,7 @@ class FileField(Field):
def deconstruct(self):
name, path, args, kwargs = super(FileField, self).deconstruct()
- if kwargs.get("max_length", None) == 100:
+ if kwargs.get("max_length") == 100:
del kwargs["max_length"]
kwargs['upload_to'] = self.upload_to
if self.storage is not default_storage:
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 5f455b12be..050994811a 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1216,7 +1216,7 @@ class RawQuerySet(object):
model_cls = deferred_class_factory(self.model, skip)
else:
model_cls = self.model
- fields = [self.model_fields.get(c, None) for c in self.columns]
+ fields = [self.model_fields.get(c) for c in self.columns]
converters = compiler.get_converters([
f.get_col(f.model._meta.db_table) if f else None for f in fields
])