summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBrad Walker <brad@bradmwalker.com>2014-11-12 16:06:12 -0700
committerTim Graham <timograham@gmail.com>2014-11-20 14:31:14 -0500
commitcfa26f29bdd9b0f82211e6f5ff7f4cd63bd66150 (patch)
tree0068429a9f2e2184ac93921175d6c68e6456b79b /django
parentf273cedc76eded138e0418c9db0b425e40797633 (diff)
Reduced reduce() usage; refs #23796.
django.core.exceptions.ValidationError.messages() and django.db.backends.schema.BaseDatabaseSchemaEditor._alter_field(): Replaced reduce(operator.add, ...) w/uncoupled, explicit sum()
Diffstat (limited to 'django')
-rw-r--r--django/core/exceptions.py5
-rw-r--r--django/db/backends/schema.py4
2 files changed, 2 insertions, 7 deletions
diff --git a/django/core/exceptions.py b/django/core/exceptions.py
index 28e712e0a5..a8b432b1c6 100644
--- a/django/core/exceptions.py
+++ b/django/core/exceptions.py
@@ -1,9 +1,6 @@
"""
Global Django exception and warning classes.
"""
-from functools import reduce
-import operator
-
from django.utils import six
from django.utils.encoding import force_text
@@ -137,7 +134,7 @@ class ValidationError(Exception):
@property
def messages(self):
if hasattr(self, 'error_dict'):
- return reduce(operator.add, dict(self).values())
+ return sum(dict(self).values(), [])
return list(self)
def update_error_dict(self, error_dict):
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
index 721be2aeb5..aa13e421d4 100644
--- a/django/db/backends/schema.py
+++ b/django/db/backends/schema.py
@@ -1,5 +1,4 @@
import hashlib
-import operator
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.utils import truncate_name
@@ -7,7 +6,6 @@ from django.db.models.fields.related import ManyToManyField
from django.db.transaction import atomic
from django.utils.encoding import force_bytes
from django.utils.log import getLogger
-from django.utils.six.moves import reduce
from django.utils import six
logger = getLogger('django.db.backends.schema')
@@ -609,7 +607,7 @@ class BaseDatabaseSchemaEditor(object):
# Combine actions together if we can (e.g. postgres)
if self.connection.features.supports_combined_alters and actions:
sql, params = tuple(zip(*actions))
- actions = [(", ".join(sql), reduce(operator.add, params))]
+ actions = [(", ".join(sql), sum(params, []))]
# Apply those actions
for sql, params in actions:
self.execute(