src/reportlab/graphics/widgetbase.py
changeset 3326 ce725978d11c
parent 3271 c14b161b62bf
child 3408 f2ce23ab0644
--- a/src/reportlab/graphics/widgetbase.py	Sat Feb 06 09:24:08 2010 +0000
+++ b/src/reportlab/graphics/widgetbase.py	Mon Feb 08 18:17:33 2010 +0000
@@ -28,9 +28,9 @@
 
         if self._attrMap is not None:
             for key in self.__dict__.keys():
-                if key[0] <> '_':
+                if key[0] != '_':
                     msg = "Unexpected attribute %s found in %s" % (key, self)
-                    assert self._attrMap.has_key(key), msg
+                    assert key in self._attrMap, msg
             for (attr, metavalue) in self._attrMap.items():
                 msg = "Missing attribute %s from %s" % (attr, self)
                 assert hasattr(self, attr), msg
@@ -65,7 +65,7 @@
 
         props = {}
         for name in self.__dict__.keys():
-            if name[0:1] <> '_':
+            if name[0:1] != '_':
                 component = getattr(self, name)
 
                 if recur and isValidChild(component):
@@ -137,7 +137,7 @@
 
     def _setKeywords(self,**kw):
         for k,v in kw.items():
-            if not self.__dict__.has_key(k):
+            if k not in self.__dict__:
                 setattr(self,k,v)
 
     def draw(self):
@@ -214,11 +214,11 @@
                     i = self._index
                     if i:
                         c = self._parent._children
-                        if c.has_key(i) and c[i].__dict__.has_key(name):
+                        if i in c and name in c[i].__dict__:
                             return getattr(c[i],name)
                         elif len(i)==1:
                             i = i[0]
-                            if c.has_key(i) and c[i].__dict__.has_key(name):
+                            if i in c and name in c[i].__dict__:
                                 return getattr(c[i],name)
                     return getattr(self._parent,name)
         return WKlass
@@ -228,7 +228,7 @@
             return self._children[index]
         except KeyError:
             Klass = self._value.__class__
-            if _ItemWrapper.has_key(Klass):
+            if Klass in _ItemWrapper:
                 WKlass = _ItemWrapper[Klass]
             else:
                 _ItemWrapper[Klass] = WKlass = self.wKlassFactory(Klass)
@@ -249,9 +249,9 @@
             self._children[index] = child
             return child
 
-    def has_key(self,key):
+    def __contains__(self,key):
         if type(key) in (type(()),type([])): key = tuple(key)
-        return self._children.has_key(key)
+        return key in self._children
 
     def __setitem__(self, key, value):
         msg = "This collection can only hold objects of type %s" % self._value.__class__.__name__
@@ -271,7 +271,7 @@
         for idx in self._children.keys():
             childProps = self._children[idx].getProperties(recur=recur)
             for (key, value) in childProps.items():
-                if not hasattr(self,key) or getattr(self, key)<>value:
+                if not hasattr(self,key) or getattr(self, key)!=value:
                     newKey = '[%s].%s' % (idx, key)
                     props[newKey] = value
         return props