summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-12-01 11:38:01 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 16:21:28 +0100
commitc716fe87821df00f9f03ecc761c914d1682591a2 (patch)
tree0436706cdb190acbc76fb5fcf6d66f16e09fafa3 /django/utils/datastructures.py
parente63d98b7beb16d1410168a2315cbe04c43c9c80d (diff)
Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index a95f8c351a..7367924600 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -179,7 +179,7 @@ class MultiValueDict(dict):
"""Appends an item to the internal list associated with key."""
self.setlistdefault(key).append(value)
- def _iteritems(self):
+ def items(self):
"""
Yields (key, value) pairs, where value is the last item in the list
associated with the key.
@@ -187,33 +187,15 @@ class MultiValueDict(dict):
for key in self:
yield key, self[key]
- def _iterlists(self):
+ def lists(self):
"""Yields (key, list) pairs."""
return six.iteritems(super(MultiValueDict, self))
- def _itervalues(self):
+ def values(self):
"""Yield the last value on every key list."""
for key in self:
yield self[key]
- if six.PY3:
- items = _iteritems
- lists = _iterlists
- values = _itervalues
- else:
- iteritems = _iteritems
- iterlists = _iterlists
- itervalues = _itervalues
-
- def items(self):
- return list(self.iteritems())
-
- def lists(self):
- return list(self.iterlists())
-
- def values(self):
- return list(self.itervalues())
-
def copy(self):
"""Returns a shallow copy of this object."""
return copy.copy(self)