Ticket #5789: userdict.patch

File userdict.patch, 3.0 KB (added by vperic, 4 years ago)

Remove UserDict

  • twisted/manhole/explorer.py

    diff --git twisted/manhole/explorer.py twisted/manhole/explorer.py
    index 30db8e2..ac11a1b 100644
    L{inspect} module available in Python 2.1. 
    1616
    1717# System Imports
    1818import inspect, string, sys, types
    19 import UserDict
    2019
    2120# Twisted Imports
    2221from twisted.spread import pb
    from twisted.python import reflect 
    2625True=(1==1)
    2726False=not True
    2827
    29 class Pool(UserDict.UserDict):
     28class Pool(dict):
    3029    def getExplorer(self, object, identifier):
    3130        oid = id(object)
    32         if oid in self.data:
     31        if oid in self:
    3332            # XXX: This potentially returns something with
    3433            # 'identifier' set to a different value.
    35             return self.data[oid]
     34            return self[oid]
    3635        else:
    3736            klass = typeTable.get(type(object), ExplorerGeneric)
    3837            e = types.InstanceType(klass, {})
    39             self.data[oid] = e
     38            self[oid] = e
    4039            klass.__init__(e, object, identifier)
    4140            return e
    4241
  • twisted/protocols/postfix.py

    diff --git twisted/protocols/postfix.py twisted/protocols/postfix.py
    index 7a2079d..43797bf 100644
    Postfix mail transport agent related protocols. 
    77"""
    88
    99import sys
    10 import UserDict
    1110import urllib
    1211
    1312from twisted.protocols import basic
    class PostfixTCPMapServer(basic.LineReceiver, policies.TimeoutMixin): 
    9291                self.sendCode(500, 'put is not implemented yet.')
    9392
    9493
    95 class PostfixTCPMapDictServerFactory(protocol.ServerFactory,
    96                                      UserDict.UserDict):
     94class PostfixTCPMapDictServerFactory(protocol.ServerFactory, dict):
    9795    """An in-memory dictionary factory for PostfixTCPMapServer."""
    9896
    9997    protocol = PostfixTCPMapServer
  • twisted/python/util.py

    diff --git twisted/python/util.py twisted/python/util.py
    index 852043c..3d4e90a 100644
    try: 
    1212    from os import setgroups, getgroups
    1313except ImportError:
    1414    setgroups = getgroups = None
    15 from UserDict import UserDict
    1615
    1716
    1817class InsensitiveDict:
    class InsensitiveDict: 
    140139                return 0
    141140        return len(self)==len(other)
    142141
    143 class OrderedDict(UserDict):
    144     """A UserDict that preserves insert order whenever possible."""
     142class OrderedDict(dict):
     143    """A dict that preserves insert order whenever possible."""
    145144    def __init__(self, dict=None, **kwargs):
    146145        self._order = []
    147146        self.data = {}
    class OrderedDict(UserDict): 
    159158    def __setitem__(self, key, value):
    160159        if not self.has_key(key):
    161160            self._order.append(key)
    162         UserDict.__setitem__(self, key, value)
     161        dict.__setitem__(self, key, value)
    163162
    164163    def copy(self):
    165164        return self.__class__(self)
    166165
    167166    def __delitem__(self, key):
    168         UserDict.__delitem__(self, key)
     167        dict.__delitem__(self, key)
    169168        self._order.remove(key)
    170169
    171170    def iteritems(self):