Try to import Python's OrderedDict
There is an OrderedDict in Python 2.7+. The try order is now as follows: * OrderedDict from Python's collections module * OrderedDict from the jsonencode module (dependency) * OrderedDict from the ordereddict module (pypi package) * our own OrderedDict
This commit is contained in:
parent
203d540163
commit
5ac2de43d7
1 changed files with 111 additions and 105 deletions
|
|
@ -19,9 +19,15 @@
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from collections import OrderedDict
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from simplejson import OrderedDict
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
from ordereddict import OrderedDict
|
from ordereddict import OrderedDict
|
||||||
except:
|
except ImportError:
|
||||||
## {{{ http://code.activestate.com/recipes/576693/ (r6)
|
## {{{ http://code.activestate.com/recipes/576693/ (r6)
|
||||||
from UserDict import DictMixin
|
from UserDict import DictMixin
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,4 +129,4 @@ except:
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return not self == other
|
return not self == other
|
||||||
## end of http://code.activestate.com/recipes/576693/ }}}
|
## end of http://code.activestate.com/recipes/576693/ }}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue