mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-17 07:49:22 +01:00
Remove utils/gen.py dependency on deprecated libraries (new and UserDict).
This commit is contained in:
parent
caaf290c9b
commit
ab978a8c31
@ -30,13 +30,12 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import new
|
|
||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
import compiler
|
import compiler
|
||||||
import textwrap
|
import textwrap
|
||||||
import UserDict
|
|
||||||
import traceback
|
import traceback
|
||||||
|
import collections
|
||||||
from itertools import imap
|
from itertools import imap
|
||||||
|
|
||||||
from str import format
|
from str import format
|
||||||
@ -231,7 +230,7 @@ class IterableMap(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class InsensitivePreservingDict(UserDict.DictMixin, object):
|
class InsensitivePreservingDict(collections.MutableMapping):
|
||||||
def key(self, s):
|
def key(self, s):
|
||||||
"""Override this if you wish."""
|
"""Override this if you wish."""
|
||||||
if s is not None:
|
if s is not None:
|
||||||
@ -265,6 +264,12 @@ class InsensitivePreservingDict(UserDict.DictMixin, object):
|
|||||||
def __delitem__(self, k):
|
def __delitem__(self, k):
|
||||||
del self.data[self.key(k)]
|
del self.data[self.key(k)]
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return iter(self.data)
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.data)
|
||||||
|
|
||||||
def iteritems(self):
|
def iteritems(self):
|
||||||
return self.data.itervalues()
|
return self.data.itervalues()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user