retire the `sortdict`, now useless since py3 (from 3.6) dicts are insert order sorted
1 files changed, 3 insertions(+), 62 deletions(-)

M inireader/__init__.py
M inireader/__init__.py +3 -62
@@ 19,65 19,6 @@ def expandpath(path):
     return os.path.expanduser(os.path.expandvars(path))
 
 
-class sortdict(dict):
-    '''a simple sorted dictionary'''
-
-    def __init__(self, data=None):
-        self._list = []
-        if data:
-            self.update(data)
-
-    def copy(self):
-        return sortdict(self)
-
-    def __setitem__(self, key, val):
-        if key in self:
-            self._list.remove(key)
-        self._list.append(key)
-        dict.__setitem__(self, key, val)
-
-    def __iter__(self):
-        return self._list.__iter__()
-
-    def update(self, src):
-        if isinstance(src, dict):
-            src = src.items()
-        for k, v in src:
-            self[k] = v
-
-    def clear(self):
-        dict.clear(self)
-        self._list = []
-
-    def items(self):
-        return [(k, self[k]) for k in self._list]
-
-    def __delitem__(self, key):
-        dict.__delitem__(self, key)
-        self._list.remove(key)
-
-    def pop(self, key, *args, **kwargs):
-        dict.pop(self, key, *args, **kwargs)
-        try:
-            self._list.remove(key)
-        except ValueError:
-            pass
-
-    def keys(self):
-        return self._list
-
-    def iterkeys(self):
-        return self._list.__iter__()
-
-    def iteritems(self):
-        for k in self._list:
-            yield k, self[k]
-
-    def insert(self, index, key, val):
-        self._list.insert(index, key)
-        dict.__setitem__(self, key, val)
-
-
 class ParseError(Exception):
     """Raised when parsing config files and {rev,file}sets (msg[, pos])"""
 

          
@@ 124,7 65,7 @@ class reader(object):
                 del self._source[(s, n)]
         for s in src:
             if s not in self:
-                self._data[s] = sortdict()
+                self._data[s] = {}
             self._data[s].update(src._data[s])
         self._source.update(src._source)
 

          
@@ 142,7 83,7 @@ class reader(object):
 
     def set(self, section, item, value, source=""):
         if section not in self:
-            self._data[section] = sortdict()
+            self._data[section] = {}
         self._data[section][item] = value
         if source:
             self._source[(section, item)] = source

          
@@ 203,7 144,7 @@ class reader(object):
                 if remap:
                     section = remap.get(section, section)
                 if section not in self:
-                    self._data[section] = sortdict()
+                    self._data[section] = {}
                 continue
             m = itemre.match(l)
             if m: