summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2012-07-14 19:04:37 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2012-07-14 19:04:37 -0700
commitc57abd3c29cedcca00821d2a0d5708f10977f3c6 (patch)
treeb8c9bfce871ee5c8c5a6e373244d6c227020d450 /django/utils/datastructures.py
parent0f57935bcd8cd525d8d661c5af4fb70b79e126ae (diff)
Remove DotExpandedDict, which was undocumented and unused.
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 69be07ba7e..16741ba36b 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -412,38 +412,6 @@ class MultiValueDict(dict):
"""
return dict((key, self[key]) for key in self)
-class DotExpandedDict(dict):
- """
- A special dictionary constructor that takes a dictionary in which the keys
- may contain dots to specify inner dictionaries. It's confusing, but this
- example should make sense.
-
- >>> d = DotExpandedDict({'person.1.firstname': ['Simon'], \
- 'person.1.lastname': ['Willison'], \
- 'person.2.firstname': ['Adrian'], \
- 'person.2.lastname': ['Holovaty']})
- >>> d
- {'person': {'1': {'lastname': ['Willison'], 'firstname': ['Simon']}, '2': {'lastname': ['Holovaty'], 'firstname': ['Adrian']}}}
- >>> d['person']
- {'1': {'lastname': ['Willison'], 'firstname': ['Simon']}, '2': {'lastname': ['Holovaty'], 'firstname': ['Adrian']}}
- >>> d['person']['1']
- {'lastname': ['Willison'], 'firstname': ['Simon']}
-
- # Gotcha: Results are unpredictable if the dots are "uneven":
- >>> DotExpandedDict({'c.1': 2, 'c.2': 3, 'c': 1})
- {'c': 1}
- """
- def __init__(self, key_to_list_mapping):
- for k, v in key_to_list_mapping.items():
- current = self
- bits = k.split('.')
- for bit in bits[:-1]:
- current = current.setdefault(bit, {})
- # Now assign value to current position
- try:
- current[bits[-1]] = v
- except TypeError: # Special-case if current isn't a dict.
- current = {bits[-1]: v}
class ImmutableList(tuple):
"""