summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-02-05 11:22:08 +0000
committerTim Graham <timograham@gmail.com>2019-02-06 13:48:39 -0500
commit24b82cd201e21060fbc02117dc16d1702877a1f3 (patch)
tree7d36db9251700d0abf8fbf69399c8abc7fd9026a /django/utils
parent21bb71ef0dcb86798edb0d8b21138bcc4b947590 (diff)
Fixed #30159 -- Removed unneeded use of OrderedDict.
Dicts preserve order since Python 3.6.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py4
-rw-r--r--django/utils/translation/trans_real.py5
-rw-r--r--django/utils/xmlutils.py3
3 files changed, 4 insertions, 8 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 191c2348f6..083cf3cb8b 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -1,16 +1,14 @@
import copy
-from collections import OrderedDict
from collections.abc import Mapping
class OrderedSet:
"""
A set which keeps the ordering of the inserted items.
- Currently backs onto OrderedDict.
"""
def __init__(self, iterable=None):
- self.dict = OrderedDict.fromkeys(iterable or ())
+ self.dict = dict.fromkeys(iterable or ())
def add(self, item):
self.dict[item] = None
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 0e53b223e5..d6f1f7f14f 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -5,7 +5,6 @@ import os
import re
import sys
import warnings
-from collections import OrderedDict
from threading import local
from django.apps import apps
@@ -385,9 +384,9 @@ def check_for_language(lang_code):
@functools.lru_cache()
def get_languages():
"""
- Cache of settings.LANGUAGES in an OrderedDict for easy lookups by key.
+ Cache of settings.LANGUAGES in a dictionary for easy lookups by key.
"""
- return OrderedDict(settings.LANGUAGES)
+ return dict(settings.LANGUAGES)
@functools.lru_cache(maxsize=1000)
diff --git a/django/utils/xmlutils.py b/django/utils/xmlutils.py
index 1a14034243..e4607b9865 100644
--- a/django/utils/xmlutils.py
+++ b/django/utils/xmlutils.py
@@ -3,7 +3,6 @@ Utilities for XML generation/parsing.
"""
import re
-from collections import OrderedDict
from xml.sax.saxutils import XMLGenerator
@@ -30,5 +29,5 @@ class SimplerXMLGenerator(XMLGenerator):
def startElement(self, name, attrs):
# Sort attrs for a deterministic output.
- sorted_attrs = OrderedDict(sorted(attrs.items())) if attrs else attrs
+ sorted_attrs = dict(sorted(attrs.items())) if attrs else attrs
super().startElement(name, sorted_attrs)