Browse Source

Fix use of has_key and map()

rdb 12 years ago
parent
commit
88048bf3da
57 changed files with 205 additions and 214 deletions
  1. 3 3
      direct/src/actor/Actor.py
  2. 11 11
      direct/src/cluster/ClusterClient.py
  3. 7 7
      direct/src/cluster/ClusterServer.py
  4. 1 1
      direct/src/directscripts/packpanda.py
  5. 2 2
      direct/src/directtools/DirectLights.py
  6. 7 7
      direct/src/directtools/DirectSession.py
  7. 1 1
      direct/src/directtools/DirectUtil.py
  8. 4 4
      direct/src/distributed/CRCache.py
  9. 1 1
      direct/src/distributed/ClientRepository.py
  10. 5 5
      direct/src/distributed/ClientRepositoryBase.py
  11. 1 1
      direct/src/distributed/DistributedCartesianGridAI.py
  12. 6 6
      direct/src/distributed/DoInterestManager.py
  13. 1 1
      direct/src/distributed/OldClientRepository.py
  14. 3 3
      direct/src/distributed/ParentMgr.py
  15. 2 2
      direct/src/distributed/ServerRepository.py
  16. 1 1
      direct/src/ffi/FFIEnvironment.py
  17. 1 1
      direct/src/ffi/FFIInterrogateDatabase.py
  18. 1 1
      direct/src/ffi/FFIOverload.py
  19. 1 1
      direct/src/ffi/FFIRename.py
  20. 52 52
      direct/src/filter/CommonFilters.py
  21. 3 3
      direct/src/gui/DirectDialog.py
  22. 5 5
      direct/src/gui/DirectGuiBase.py
  23. 1 1
      direct/src/gui/DirectGuiTest.py
  24. 3 3
      direct/src/gui/DirectScrolledList.py
  25. 1 1
      direct/src/gui/DirectWaitBar.py
  26. 1 1
      direct/src/http/WebRequest.py
  27. 3 3
      direct/src/http/webAIInspector.py
  28. 4 4
      direct/src/interval/MetaInterval.py
  29. 3 3
      direct/src/leveleditor/ObjectPropertyUI.py
  30. 7 7
      direct/src/p3d/DeploymentTools.py
  31. 2 2
      direct/src/p3d/FileSpec.py
  32. 6 6
      direct/src/p3d/PackageInfo.py
  33. 5 5
      direct/src/p3d/Packager.py
  34. 1 1
      direct/src/p3d/packp3d.py
  35. 1 1
      direct/src/plugin_installer/make_installer.py
  36. 1 1
      direct/src/plugin_standalone/make_osx_bundle.py
  37. 1 1
      direct/src/pyinst/finder.py
  38. 6 6
      direct/src/pyinst/modulefinder.py
  39. 1 1
      direct/src/pyinst/resource.py
  40. 3 3
      direct/src/showbase/Audio3DManager.py
  41. 1 1
      direct/src/showbase/Factory.py
  42. 1 4
      direct/src/showbase/PythonUtil.py
  43. 1 1
      direct/src/showbase/VFSImporter.py
  44. 1 1
      direct/src/showbase/VerboseImport.py
  45. 1 1
      direct/src/showutil/TexMemWatcher.py
  46. 2 3
      direct/src/tkpanels/DirectSessionPanel.py
  47. 3 3
      direct/src/tkpanels/Inspector.py
  48. 1 1
      direct/src/tkpanels/MopathRecorder.py
  49. 2 2
      direct/src/tkpanels/ParticlePanel.py
  50. 1 1
      direct/src/tkpanels/Placer.py
  51. 1 2
      direct/src/tkwidgets/EntryScale.py
  52. 1 2
      direct/src/tkwidgets/Floater.py
  53. 1 1
      direct/src/tkwidgets/Slider.py
  54. 3 3
      direct/src/tkwidgets/Tree.py
  55. 3 5
      direct/src/tkwidgets/Valuator.py
  56. 1 2
      direct/src/tkwidgets/VectorWidgets.py
  57. 12 12
      direct/src/wxwidgets/WxPandaShell.py

+ 3 - 3
direct/src/actor/Actor.py

@@ -1006,7 +1006,7 @@ class Actor(DirectObject, NodePath):
             return
             return
 
 
         # remove the part
         # remove the part
-        if (partBundleDict.has_key(partName)):
+        if (partName in partBundleDict):
             partBundleDict[partName].partBundleNP.removeNode()
             partBundleDict[partName].partBundleNP.removeNode()
             del(partBundleDict[partName])
             del(partBundleDict[partName])
 
 
@@ -1019,7 +1019,7 @@ class Actor(DirectObject, NodePath):
             return
             return
 
 
         # remove the animations
         # remove the animations
-        if (partDict.has_key(partName)):
+        if (partName in partDict):
             del(partDict[partName])
             del(partDict[partName])
 
 
         # remove the bundle handle, in case this part is ever
         # remove the bundle handle, in case this part is ever
@@ -1802,7 +1802,7 @@ class Actor(DirectObject, NodePath):
                 # Get all main parts, but not sub-parts.
                 # Get all main parts, but not sub-parts.
                 animDictItems = []
                 animDictItems = []
                 for thisPart, animDict in partDict.items():
                 for thisPart, animDict in partDict.items():
-                    if not self.__subpartDict.has_key(thisPart):
+                    if thisPart not in self.__subpartDict:
                         animDictItems.append((thisPart, animDict))
                         animDictItems.append((thisPart, animDict))
 
 
             else:
             else:

+ 11 - 11
direct/src/cluster/ClusterClient.py

@@ -137,7 +137,7 @@ class ClusterClient(DirectObject.DirectObject):
             object     = pair[1]
             object     = pair[1]
             name       = self.controlMappings[object][0]
             name       = self.controlMappings[object][0]
             serverList = self.controlMappings[object][1]
             serverList = self.controlMappings[object][1]
-            if (self.objectMappings.has_key(object)):
+            if (object in self.objectMappings):
                 self.moveObject(self.objectMappings[object],name,serverList,
                 self.moveObject(self.objectMappings[object],name,serverList,
                                 self.controlOffsets[object], self.objectHasColor[object])
                                 self.controlOffsets[object], self.objectHasColor[object])
         self.sendNamedMovementDone()
         self.sendNamedMovementDone()
@@ -204,20 +204,20 @@ class ClusterClient(DirectObject.DirectObject):
 
 
 
 
     def addNamedObjectMapping(self,object,name,hasColor = True):
     def addNamedObjectMapping(self,object,name,hasColor = True):
-        if (not self.objectMappings.has_key(name)):
+        if (name not in self.objectMappings):
             self.objectMappings[name] = object
             self.objectMappings[name] = object
             self.objectHasColor[name] = hasColor
             self.objectHasColor[name] = hasColor
         else:
         else:
             self.notify.debug('attempt to add duplicate named object: '+name)
             self.notify.debug('attempt to add duplicate named object: '+name)
 
 
     def removeObjectMapping(self,name):
     def removeObjectMapping(self,name):
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings.pop(name)
             self.objectMappings.pop(name)
 
 
 
 
     def addControlMapping(self,objectName,controlledName, serverList = None,
     def addControlMapping(self,objectName,controlledName, serverList = None,
                           offset = None, priority = 0):
                           offset = None, priority = 0):
-        if (not self.controlMappings.has_key(objectName)):
+        if (objectName not in self.controlMappings):
             if (serverList == None):
             if (serverList == None):
                 serverList = range(len(self.serverList))
                 serverList = range(len(self.serverList))
             if (offset == None):
             if (offset == None):
@@ -239,11 +239,11 @@ class ClusterClient(DirectObject.DirectObject):
             #self.notify.debug('attempt to add duplicate controlled object: '+name)
             #self.notify.debug('attempt to add duplicate controlled object: '+name)
 
 
     def setControlMappingOffset(self,objectName,offset):
     def setControlMappingOffset(self,objectName,offset):
-        if (self.controlMappings.has_key(objectName)):
+        if (objectName in self.controlMappings):
             self.controlOffsets[objectName] = offset
             self.controlOffsets[objectName] = offset
 
 
     def removeControlMapping(self,name, serverList = None):
     def removeControlMapping(self,name, serverList = None):
-        if (self.controlMappings.has_key(name)):
+        if (name in self.controlMappings):
 
 
             if (serverList == None):
             if (serverList == None):
                 self.controlMappings.pop(name)
                 self.controlMappings.pop(name)
@@ -299,7 +299,7 @@ class ClusterClient(DirectObject.DirectObject):
 
 
     def selectNodePath(self, nodePath):
     def selectNodePath(self, nodePath):
         name = self.getNodePathName(nodePath)
         name = self.getNodePathName(nodePath)
-        if self.taggedObjects.has_key(name):
+        if name in self.taggedObjects:
             taskMgr.remove("moveSelectedTask")
             taskMgr.remove("moveSelectedTask")
             tag = self.taggedObjects[name]
             tag = self.taggedObjects[name]
             function = tag["selectFunction"]
             function = tag["selectFunction"]
@@ -312,7 +312,7 @@ class ClusterClient(DirectObject.DirectObject):
 
 
     def deselectNodePath(self, nodePath):
     def deselectNodePath(self, nodePath):
         name = self.getNodePathName(nodePath)
         name = self.getNodePathName(nodePath)
-        if self.taggedObjects.has_key(name):
+        if name in self.taggedObjects:
             tag = self.taggedObjects[name]
             tag = self.taggedObjects[name]
             function = tag["deselectFunction"]
             function = tag["deselectFunction"]
             args     = tag["deselectArgs"]        
             args     = tag["deselectArgs"]        
@@ -323,7 +323,7 @@ class ClusterClient(DirectObject.DirectObject):
 
 
     def sendCamFrustum(self, focalLength, filmSize, filmOffset, indexList=[]):
     def sendCamFrustum(self, focalLength, filmSize, filmOffset, indexList=[]):
         if indexList:
         if indexList:
-            serverList = map(lambda i: self.serverList[i], indexList)
+            serverList = [self.serverList[i] for i in indexList]
         else:
         else:
             serverList = self.serverList
             serverList = self.serverList
         for server in serverList:
         for server in serverList:
@@ -381,7 +381,7 @@ class ClusterClient(DirectObject.DirectObject):
         #print "name"
         #print "name"
         #if (name == "camNode"):
         #if (name == "camNode"):
         #    print x,y,z,h,p,r, sx, sy, sz,red,g,b,a, hidden
         #    print x,y,z,h,p,r, sx, sy, sz,red,g,b,a, hidden
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             if (self.objectHasColor[name]):
             if (self.objectHasColor[name]):
@@ -598,7 +598,7 @@ def createClusterClient():
     # setup camera offsets based on cluster-config
     # setup camera offsets based on cluster-config
     clusterConfig = base.config.GetString('cluster-config', 'single-server')
     clusterConfig = base.config.GetString('cluster-config', 'single-server')
     # No cluster config specified!
     # No cluster config specified!
-    if not ClientConfigs.has_key(clusterConfig):
+    if clusterConfig not in ClientConfigs:
         base.notify.warning(
         base.notify.warning(
             'createClusterClient: %s cluster-config is undefined.' %
             'createClusterClient: %s cluster-config is undefined.' %
             clusterConfig)
             clusterConfig)

+ 7 - 7
direct/src/cluster/ClusterServer.py

@@ -102,14 +102,14 @@ class ClusterServer(DirectObject.DirectObject):
 
 
     def addNamedObjectMapping(self,object,name,hasColor = True,
     def addNamedObjectMapping(self,object,name,hasColor = True,
                               priority = 0):
                               priority = 0):
-        if (not self.objectMappings.has_key(name)):
+        if (name not in self.objectMappings):
             self.objectMappings[name] = object
             self.objectMappings[name] = object
             self.objectHasColor[name] = hasColor
             self.objectHasColor[name] = hasColor
         else:
         else:
             self.notify.debug('attempt to add duplicate named object: '+name)
             self.notify.debug('attempt to add duplicate named object: '+name)
 
 
     def removeObjectMapping(self,name):
     def removeObjectMapping(self,name):
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings.pop(name)
             self.objectMappings.pop(name)
 
 
 
 
@@ -125,7 +125,7 @@ class ClusterServer(DirectObject.DirectObject):
 
 
     def addControlMapping(self,objectName,controlledName, offset = None,
     def addControlMapping(self,objectName,controlledName, offset = None,
                           priority = 0):
                           priority = 0):
-        if (not self.controlMappings.has_key(objectName)):
+        if (objectName not in self.controlMappings):
             self.controlMappings[objectName] = controlledName
             self.controlMappings[objectName] = controlledName
             if (offset == None):
             if (offset == None):
                 offset = Vec3(0,0,0)
                 offset = Vec3(0,0,0)
@@ -136,12 +136,12 @@ class ClusterServer(DirectObject.DirectObject):
             self.notify.debug('attempt to add duplicate controlled object: '+name)
             self.notify.debug('attempt to add duplicate controlled object: '+name)
 
 
     def setControlMappingOffset(self,objectName,offset):
     def setControlMappingOffset(self,objectName,offset):
-        if (self.controlMappings.has_key(objectName)):
+        if (objectName in self.controlMappings):
             self.controlOffsets[objectName] = offset
             self.controlOffsets[objectName] = offset
     
     
 
 
     def removeControlMapping(self,name):
     def removeControlMapping(self,name):
-        if (self.controlMappings.has_key(name)):
+        if (name in self.controlMappings):
             self.controlMappings.pop(name)
             self.controlMappings.pop(name)
             self.controlPriorities.pop(name)
             self.controlPriorities.pop(name)
         self.redoSortedPriorities()
         self.redoSortedPriorities()
@@ -156,7 +156,7 @@ class ClusterServer(DirectObject.DirectObject):
         for pair in self.sortedControlPriorities:
         for pair in self.sortedControlPriorities:
             object = pair[1]
             object = pair[1]
             name   = self.controlMappings[object] 
             name   = self.controlMappings[object] 
-            if (self.objectMappings.has_key(object)):
+            if (object in self.objectMappings):
                 self.moveObject(self.objectMappings[object],name,self.controlOffsets[object],
                 self.moveObject(self.objectMappings[object],name,self.controlOffsets[object],
                                 self.objectHasColor[object])
                                 self.objectHasColor[object])
 
 
@@ -297,7 +297,7 @@ class ClusterServer(DirectObject.DirectObject):
     def handleNamedMovement(self, data):
     def handleNamedMovement(self, data):
         """ Update cameraJig position to reflect latest position """
         """ Update cameraJig position to reflect latest position """
         (name,x, y, z, h, p, r,sx,sy,sz, red, g, b, a, hidden) = data
         (name,x, y, z, h, p, r,sx,sy,sz, red, g, b, a, hidden) = data
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             self.objectMappings[name].setColor(red,g,b,a)
             self.objectMappings[name].setColor(red,g,b,a)

+ 1 - 1
direct/src/directscripts/packpanda.py

@@ -165,7 +165,7 @@ if (sys.platform == "win32"):
 
 
 def limitedCopyTree(src, dst, rmdir):
 def limitedCopyTree(src, dst, rmdir):
     if (os.path.isdir(src)):
     if (os.path.isdir(src)):
-        if (rmdir.has_key(os.path.basename(src))):
+        if (os.path.basename(src) in rmdir):
             return
             return
         if (not os.path.isdir(dst)): os.mkdir(dst)
         if (not os.path.isdir(dst)): os.mkdir(dst)
         for x in os.listdir(src):
         for x in os.listdir(src):

+ 2 - 2
direct/src/directtools/DirectLights.py

@@ -48,11 +48,11 @@ class DirectLights(NodePath):
             self.delete(light)
             self.delete(light)
 
 
     def asList(self):
     def asList(self):
-        return map(lambda n, s=self: s[n], self.getNameList())
+        return [self[n] for n in self.getNameList()]
 
 
     def getNameList(self):
     def getNameList(self):
         # Return a sorted list of all lights in the light dict
         # Return a sorted list of all lights in the light dict
-        nameList = map(lambda x: x.getName(), self.lightDict.values())
+        nameList = [x.getName() for x in self.lightDict.values()]
         nameList.sort()
         nameList.sort()
         return nameList
         return nameList
 
 

+ 7 - 7
direct/src/directtools/DirectSession.py

@@ -42,7 +42,7 @@ class DirectSession(DirectObject):
         self.fIgnoreDirectOnlyKeyMap = 0 # [gjeon] to skip old direct controls in new LE
         self.fIgnoreDirectOnlyKeyMap = 0 # [gjeon] to skip old direct controls in new LE
 
 
         self.drList = DisplayRegionList()
         self.drList = DisplayRegionList()
-        self.iRayList = map(lambda x: x.iRay, self.drList)
+        self.iRayList = [x.iRay for x in self.drList]
         self.dr = self.drList[0]
         self.dr = self.drList[0]
         self.win = base.win
         self.win = base.win
         self.camera = base.camera
         self.camera = base.camera
@@ -196,8 +196,8 @@ class DirectSession(DirectObject):
                               'alt', 'alt-up', 'alt-repeat',
                               'alt', 'alt-up', 'alt-repeat',
                                ]
                                ]
 
 
-        keyList = map(chr, range(97, 123))
-        keyList.extend(map(chr, range(48, 58)))
+        keyList = [chr(i) for i in range(97, 123)]
+        keyList.extend([chr(i) for i in range(48, 58)])
         keyList.extend(["`", "-", "=", "[", "]", ";", "'", ",", ".", "/", "\\"])
         keyList.extend(["`", "-", "=", "[", "]", ";", "'", ",", ".", "/", "\\"])
 
 
         self.specialKeys = ['escape', 'delete', 'page_up', 'page_down', 'enter']
         self.specialKeys = ['escape', 'delete', 'page_up', 'page_down', 'enter']
@@ -209,8 +209,8 @@ class DirectSession(DirectObject):
             return "shift-%s"%a
             return "shift-%s"%a
 
 
         self.keyEvents = keyList[:]
         self.keyEvents = keyList[:]
-        self.keyEvents.extend(map(addCtrl, keyList))
-        self.keyEvents.extend(map(addShift, keyList))        
+        self.keyEvents.extend(list(map(addCtrl, keyList)))
+        self.keyEvents.extend(list(map(addShift, keyList)))        
         self.keyEvents.extend(self.specialKeys)
         self.keyEvents.extend(self.specialKeys)
 
 
         self.mouseEvents = ['mouse1', 'mouse1-up',
         self.mouseEvents = ['mouse1', 'mouse1-up',
@@ -996,7 +996,7 @@ class DirectSession(DirectObject):
             # Get last item off of redo list
             # Get last item off of redo list
             undoGroup = self.popUndoGroup()
             undoGroup = self.popUndoGroup()
             # Record redo information
             # Record redo information
-            nodePathList = map(lambda x: x[0], undoGroup)
+            nodePathList = [x[0] for x in undoGroup]
             self.pushRedo(nodePathList)
             self.pushRedo(nodePathList)
             # Now undo xform for group
             # Now undo xform for group
             for pose in undoGroup:
             for pose in undoGroup:
@@ -1010,7 +1010,7 @@ class DirectSession(DirectObject):
             # Get last item off of redo list
             # Get last item off of redo list
             redoGroup = self.popRedoGroup()
             redoGroup = self.popRedoGroup()
             # Record undo information
             # Record undo information
-            nodePathList = map(lambda x: x[0], redoGroup)
+            nodePathList = [x[0] for x in redoGroup]
             self.pushUndo(nodePathList, fResetRedo = 0)
             self.pushUndo(nodePathList, fResetRedo = 0)
             # Redo xform
             # Redo xform
             for pose in redoGroup:
             for pose in redoGroup:

+ 1 - 1
direct/src/directtools/DirectUtil.py

@@ -79,7 +79,7 @@ def getFileData(filename, separator = ','):
         if l:
         if l:
             # If its a valid line, split on separator and
             # If its a valid line, split on separator and
             # strip leading/trailing whitespace from each element
             # strip leading/trailing whitespace from each element
-            data = map(lambda s: s.strip(), l.split(separator))
+            data = [s.strip() for s in l.split(separator)]
             fileData.append(data)
             fileData.append(data)
     return fileData
     return fileData
 
 

+ 4 - 4
direct/src/distributed/CRCache.py

@@ -59,7 +59,7 @@ class CRCache:
         doId = distObj.getDoId()
         doId = distObj.getDoId()
         # Error check
         # Error check
         success = False
         success = False
-        if self.dict.has_key(doId):
+        if doId in self.dict:
             CRCache.notify.warning("Double cache attempted for distObj "
             CRCache.notify.warning("Double cache attempted for distObj "
                                    + str(doId))
                                    + str(doId))
         else:
         else:
@@ -89,7 +89,7 @@ class CRCache:
 
 
     def retrieve(self, doId):
     def retrieve(self, doId):
         assert self.checkCache()
         assert self.checkCache()
-        if self.dict.has_key(doId):
+        if doId in self.dict:
             # Find the object
             # Find the object
             distObj = self.dict[doId]
             distObj = self.dict[doId]
             # Remove it from the dictionary
             # Remove it from the dictionary
@@ -103,11 +103,11 @@ class CRCache:
             return None
             return None
 
 
     def contains(self, doId):
     def contains(self, doId):
-        return self.dict.has_key(doId)
+        return doId in self.dict
 
 
     def delete(self, doId):
     def delete(self, doId):
         assert self.checkCache()
         assert self.checkCache()
-        assert self.dict.has_key(doId)
+        assert doId in self.dict
         # Look it up
         # Look it up
         distObj = self.dict[doId]
         distObj = self.dict[doId]
         # Remove it from the dict and fifo
         # Remove it from the dict and fifo

+ 1 - 1
direct/src/distributed/ClientRepository.py

@@ -372,7 +372,7 @@ class ClientRepository(ClientRepositoryBase):
         This is not a distributed message and does not delete the
         This is not a distributed message and does not delete the
         object on the server or on any other client.
         object on the server or on any other client.
         """
         """
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # If it is in the dictionary, remove it.
             # If it is in the dictionary, remove it.
             obj = self.doId2do[doId]
             obj = self.doId2do[doId]
             # Remove it from the dictionary
             # Remove it from the dictionary

+ 5 - 5
direct/src/distributed/ClientRepositoryBase.py

@@ -221,7 +221,7 @@ class ClientRepositoryBase(ConnectionRepository):
         return Task.done
         return Task.done
 
 
     def generateWithRequiredFields(self, dclass, doId, di, parentId, zoneId):
     def generateWithRequiredFields(self, dclass, doId, di, parentId, zoneId):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # ...it is in our dictionary.
             # Just update it.
             # Just update it.
             distObj = self.doId2do[doId]
             distObj = self.doId2do[doId]
@@ -269,7 +269,7 @@ class ClientRepositoryBase(ConnectionRepository):
 
 
     def generateWithRequiredOtherFields(self, dclass, doId, di,
     def generateWithRequiredOtherFields(self, dclass, doId, di,
                                         parentId = None, zoneId = None):
                                         parentId = None, zoneId = None):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # ...it is in our dictionary.
             # Just update it.
             # Just update it.
             distObj = self.doId2do[doId]
             distObj = self.doId2do[doId]
@@ -315,7 +315,7 @@ class ClientRepositoryBase(ConnectionRepository):
         return distObj
         return distObj
 
 
     def generateWithRequiredOtherFieldsOwner(self, dclass, doId, di):
     def generateWithRequiredOtherFieldsOwner(self, dclass, doId, di):
-        if self.doId2ownerView.has_key(doId):
+        if doId in self.doId2ownerView:
             # ...it is in our dictionary.
             # ...it is in our dictionary.
             # Just update it.
             # Just update it.
             self.notify.error('duplicate owner generate for %s (%s)' % (
             self.notify.error('duplicate owner generate for %s (%s)' % (
@@ -359,7 +359,7 @@ class ClientRepositoryBase(ConnectionRepository):
     def disableDoId(self, doId, ownerView=False):
     def disableDoId(self, doId, ownerView=False):
         table, cache = self.getTables(ownerView)
         table, cache = self.getTables(ownerView)
         # Make sure the object exists
         # Make sure the object exists
-        if table.has_key(doId):
+        if doId in table:
             # Look up the object
             # Look up the object
             distObj = table[doId]
             distObj = table[doId]
             # remove the object from the dictionary
             # remove the object from the dictionary
@@ -378,7 +378,7 @@ class ClientRepositoryBase(ConnectionRepository):
                     # make sure we're not leaking
                     # make sure we're not leaking
                     distObj.detectLeaks()
                     distObj.detectLeaks()
 
 
-        elif self.deferredDoIds.has_key(doId):
+        elif doId in self.deferredDoIds:
             # The object had been deferred.  Great; we don't even have
             # The object had been deferred.  Great; we don't even have
             # to generate it now.
             # to generate it now.
             del self.deferredDoIds[doId]
             del self.deferredDoIds[doId]

+ 1 - 1
direct/src/distributed/DistributedCartesianGridAI.py

@@ -65,7 +65,7 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
 
 
         # Remove grid parent for this av
         # Remove grid parent for this av
         avId = av.doId
         avId = av.doId
-        if self.gridObjects.has_key(avId):
+        if avId in self.gridObjects:
             del self.gridObjects[avId]
             del self.gridObjects[avId]
 
 
         # Stop task if there are no more av's being managed
         # Stop task if there are no more av's being managed

+ 6 - 6
direct/src/distributed/DoInterestManager.py

@@ -147,7 +147,7 @@ class DoInterestManager(DirectObject.DirectObject):
         # still a valid interest handle
         # still a valid interest handle
         if not isinstance(handle, InterestHandle):
         if not isinstance(handle, InterestHandle):
             return False
             return False
-        return DoInterestManager._interests.has_key(handle.asInt())
+        return handle.asInt() in DoInterestManager._interests
 
 
     def updateInterestDescription(self, handle, desc):
     def updateInterestDescription(self, handle, desc):
         iState = DoInterestManager._interests.get(handle.asInt())
         iState = DoInterestManager._interests.get(handle.asInt())
@@ -240,7 +240,7 @@ class DoInterestManager(DirectObject.DirectObject):
         if not event:
         if not event:
             event = self._getAnonymousEvent('removeInterest')
             event = self._getAnonymousEvent('removeInterest')
         handle = handle.asInt()
         handle = handle.asInt()
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             existed = True
             existed = True
             intState = DoInterestManager._interests[handle]
             intState = DoInterestManager._interests[handle]
             if event:
             if event:
@@ -287,7 +287,7 @@ class DoInterestManager(DirectObject.DirectObject):
         assert isinstance(handle, InterestHandle)
         assert isinstance(handle, InterestHandle)
         existed = False
         existed = False
         handle = handle.asInt()
         handle = handle.asInt()
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             existed = True
             existed = True
             intState = DoInterestManager._interests[handle]
             intState = DoInterestManager._interests[handle]
             if intState.isPendingDelete():
             if intState.isPendingDelete():
@@ -345,7 +345,7 @@ class DoInterestManager(DirectObject.DirectObject):
         exists = False
         exists = False
         if event is None:
         if event is None:
             event = self._getAnonymousEvent('alterInterest')
             event = self._getAnonymousEvent('alterInterest')
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             if description is not None:
             if description is not None:
                 DoInterestManager._interests[handle].desc = description
                 DoInterestManager._interests[handle].desc = description
             else:
             else:
@@ -427,7 +427,7 @@ class DoInterestManager(DirectObject.DirectObject):
         """
         """
         assert DoInterestManager.notify.debugCall()
         assert DoInterestManager.notify.debugCall()
         
         
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             if DoInterestManager._interests[handle].isPendingDelete():
             if DoInterestManager._interests[handle].isPendingDelete():
                 # make sure there is no pending event for this interest
                 # make sure there is no pending event for this interest
                 if DoInterestManager._interests[handle].context == NO_CONTEXT:
                 if DoInterestManager._interests[handle].context == NO_CONTEXT:
@@ -594,7 +594,7 @@ class DoInterestManager(DirectObject.DirectObject):
         DoInterestManager.notify.debug(
         DoInterestManager.notify.debug(
             "handleInterestDoneMessage--> Received handle %s, context %s" % (
             "handleInterestDoneMessage--> Received handle %s, context %s" % (
             handle, contextId))
             handle, contextId))
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             eventsToSend = []
             eventsToSend = []
             # if the context matches, send out the event
             # if the context matches, send out the event
             if contextId == DoInterestManager._interests[handle].context:
             if contextId == DoInterestManager._interests[handle].context:

+ 1 - 1
direct/src/distributed/OldClientRepository.py

@@ -168,7 +168,7 @@ class OldClientRepository(ClientRepositoryBase):
         dclass.stopGenerate()
         dclass.stopGenerate()
 
 
     def generateWithRequiredFields(self, dclass, doId, di):
     def generateWithRequiredFields(self, dclass, doId, di):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # ...it is in our dictionary.
             # Just update it.
             # Just update it.
             distObj = self.doId2do[doId]
             distObj = self.doId2do[doId]

+ 3 - 3
direct/src/distributed/ParentMgr.py

@@ -57,7 +57,7 @@ class ParentMgr:
             self.pendingParentToken2children[parentToken].remove(child)
             self.pendingParentToken2children[parentToken].remove(child)
 
 
     def requestReparent(self, child, parentToken):
     def requestReparent(self, child, parentToken):
-        if self.token2nodepath.has_key(parentToken):
+        if parentToken in self.token2nodepath:
             # this parent has registered
             # this parent has registered
             # this child may already be waiting on a different parent;
             # this child may already be waiting on a different parent;
             # make sure they aren't any more
             # make sure they aren't any more
@@ -82,7 +82,7 @@ class ParentMgr:
             child.reparentTo(hidden)
             child.reparentTo(hidden)
             
             
     def registerParent(self, token, parent):
     def registerParent(self, token, parent):
-        if self.token2nodepath.has_key(token):
+        if token in self.token2nodepath:
             self.notify.error(
             self.notify.error(
                 "registerParent: token '%s' already registered, referencing %s" %
                 "registerParent: token '%s' already registered, referencing %s" %
                 (token, repr(self.token2nodepath[token])))
                 (token, repr(self.token2nodepath[token])))
@@ -141,7 +141,7 @@ class ParentMgr:
                 del self.pendingChild2parentToken[child]
                 del self.pendingChild2parentToken[child]
 
 
     def unregisterParent(self, token):
     def unregisterParent(self, token):
-        if not self.token2nodepath.has_key(token):
+        if token not in self.token2nodepath:
             self.notify.warning("unregisterParent: unknown parent token '%s'" %
             self.notify.warning("unregisterParent: unknown parent token '%s'" %
                                 token)
                                 token)
             return
             return

+ 2 - 2
direct/src/distributed/ServerRepository.py

@@ -699,7 +699,7 @@ class ServerRepository:
         
         
         if self.notify.getDebug():
         if self.notify.getDebug():
             self.notify.debug(
             self.notify.debug(
-                "ServerRepository sending to all in zone %s except %s:" % (zoneId, map(lambda c: c.doIdBase, exceptionList)))
+                "ServerRepository sending to all in zone %s except %s:" % (zoneId, [c.doIdBase for c in exceptionList]))
             #datagram.dumpHex(ostream)
             #datagram.dumpHex(ostream)
 
 
         for client in self.zonesToClients.get(zoneId, []):
         for client in self.zonesToClients.get(zoneId, []):
@@ -716,7 +716,7 @@ class ServerRepository:
         
         
         if self.notify.getDebug():
         if self.notify.getDebug():
             self.notify.debug(
             self.notify.debug(
-                "ServerRepository sending to all except %s:" % (map(lambda c: c.doIdBase, exceptionList),))
+                "ServerRepository sending to all except %s:" % ([c.doIdBase for c in exceptionList],))
             #datagram.dumpHex(ostream)
             #datagram.dumpHex(ostream)
 
 
         for client in self.clientsByConnection.values():
         for client in self.clientsByConnection.values():

+ 1 - 1
direct/src/ffi/FFIEnvironment.py

@@ -12,7 +12,7 @@ class FFIEnvironment:
         self.manifests = []
         self.manifests = []
     
     
     def addType(self, typeDescriptor, name):
     def addType(self, typeDescriptor, name):
-        if self.types.has_key(name):
+        if name in self.types:
             FFIConstants.notify.info('Redefining type named: ' + name)
             FFIConstants.notify.info('Redefining type named: ' + name)
         self.types[name] = typeDescriptor
         self.types[name] = typeDescriptor
     
     

+ 1 - 1
direct/src/ffi/FFIInterrogateDatabase.py

@@ -238,7 +238,7 @@ class FFIInterrogateDatabase:
         self.environment = FFIEnvironment.FFIEnvironment()
         self.environment = FFIEnvironment.FFIEnvironment()
 
 
     def isDefinedType(self, typeIndex):
     def isDefinedType(self, typeIndex):
-        return self.typeIndexMap.has_key(typeIndex)
+        return typeIndex in self.typeIndexMap
     
     
     def constructDescriptor(self, typeIndex):
     def constructDescriptor(self, typeIndex):
         if interrogate_type_is_atomic(typeIndex):
         if interrogate_type_is_atomic(typeIndex):

+ 1 - 1
direct/src/ffi/FFIOverload.py

@@ -337,7 +337,7 @@ class FFIMethodArgumentTree:
                 # methodSpec in this dictionary
                 # methodSpec in this dictionary
                 self.tree[typeDesc] = [None, methodSpec]
                 self.tree[typeDesc] = [None, methodSpec]
             else:
             else:
-                if self.tree.has_key(typeDesc):
+                if typeDesc in self.tree:
                     # If there already is a tree here, jump into and pass the
                     # If there already is a tree here, jump into and pass the
                     # cdr of the arg list
                     # cdr of the arg list
                     subTree = self.tree[typeDesc][0]
                     subTree = self.tree[typeDesc][0]

+ 1 - 1
direct/src/ffi/FFIRename.py

@@ -108,7 +108,7 @@ def classNameFromCppName(cppName):
             firstChar = 0
             firstChar = 0
         else:
         else:
             className = className + char
             className = className + char
-    if classRenameDictionary.has_key(className):
+    if className in classRenameDictionary:
         className = classRenameDictionary[className]
         className = classRenameDictionary[className]
 
 
     if (className == ''):
     if (className == ''):

+ 52 - 52
direct/src/filter/CommonFilters.py

@@ -86,28 +86,28 @@ class CommonFilters:
             auxbits = 0
             auxbits = 0
             needtex = {}
             needtex = {}
             needtex["color"] = True
             needtex["color"] = True
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 needtex["aux"] = True
                 needtex["aux"] = True
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 needtex["depth"] = True
                 needtex["depth"] = True
                 needtex["ssao0"] = True
                 needtex["ssao0"] = True
                 needtex["ssao1"] = True
                 needtex["ssao1"] = True
                 needtex["ssao2"] = True
                 needtex["ssao2"] = True
                 needtex["aux"] = True
                 needtex["aux"] = True
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 needtex["blur0"] = True
                 needtex["blur0"] = True
                 needtex["blur1"] = True
                 needtex["blur1"] = True
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 needtex["bloom0"] = True
                 needtex["bloom0"] = True
                 needtex["bloom1"] = True
                 needtex["bloom1"] = True
                 needtex["bloom2"] = True
                 needtex["bloom2"] = True
                 needtex["bloom3"] = True
                 needtex["bloom3"] = True
                 auxbits |= AuxBitplaneAttrib.ABOGlow
                 auxbits |= AuxBitplaneAttrib.ABOGlow
-            if (configuration.has_key("ViewGlow")):
+            if ("ViewGlow" in configuration):
                 auxbits |= AuxBitplaneAttrib.ABOGlow
                 auxbits |= AuxBitplaneAttrib.ABOGlow
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 needtex[configuration["VolumetricLighting"].source] = True
                 needtex[configuration["VolumetricLighting"].source] = True
             for tex in needtex:
             for tex in needtex:
                 self.textures[tex] = Texture("scene-"+tex)
                 self.textures[tex] = Texture("scene-"+tex)
@@ -120,7 +120,7 @@ class CommonFilters:
                 self.cleanup()
                 self.cleanup()
                 return False
                 return False
 
 
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 blur0=self.textures["blur0"]
                 blur0=self.textures["blur0"]
                 blur1=self.textures["blur1"]
                 blur1=self.textures["blur1"]
                 self.blur.append(self.manager.renderQuadInto(colortex=blur0,div=2))
                 self.blur.append(self.manager.renderQuadInto(colortex=blur0,div=2))
@@ -130,7 +130,7 @@ class CommonFilters:
                 self.blur[1].setShaderInput("src", blur0)
                 self.blur[1].setShaderInput("src", blur0)
                 self.blur[1].setShader(self.loadShader("filter-blury.sha"))
                 self.blur[1].setShader(self.loadShader("filter-blury.sha"))
 
 
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 ssao0=self.textures["ssao0"]
                 ssao0=self.textures["ssao0"]
                 ssao1=self.textures["ssao1"]
                 ssao1=self.textures["ssao1"]
                 ssao2=self.textures["ssao2"]
                 ssao2=self.textures["ssao2"]
@@ -146,7 +146,7 @@ class CommonFilters:
                 self.ssao[2].setShaderInput("src", ssao1)
                 self.ssao[2].setShaderInput("src", ssao1)
                 self.ssao[2].setShader(self.loadShader("filter-blury.sha"))
                 self.ssao[2].setShader(self.loadShader("filter-blury.sha"))
 
 
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 bloomconf = configuration["Bloom"]
                 bloomconf = configuration["Bloom"]
                 bloom0=self.textures["bloom0"]
                 bloom0=self.textures["bloom0"]
                 bloom1=self.textures["bloom1"]
                 bloom1=self.textures["bloom1"]
@@ -180,74 +180,74 @@ class CommonFilters:
             text += " uniform float4 texpad_txcolor,\n"
             text += " uniform float4 texpad_txcolor,\n"
             text += " uniform float4 texpix_txcolor,\n"
             text += " uniform float4 texpix_txcolor,\n"
             text += " out float4 l_texcoordC : TEXCOORD0,\n"
             text += " out float4 l_texcoordC : TEXCOORD0,\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += " uniform float4 texpad_txaux,\n"
                 text += " uniform float4 texpad_txaux,\n"
                 text += " uniform float4 texpix_txaux,\n"
                 text += " uniform float4 texpix_txaux,\n"
                 text += " out float4 l_texcoordN : TEXCOORD1,\n"
                 text += " out float4 l_texcoordN : TEXCOORD1,\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += " uniform float4 texpad_txbloom3,\n"
                 text += " uniform float4 texpad_txbloom3,\n"
                 text += " out float4 l_texcoordB : TEXCOORD2,\n"
                 text += " out float4 l_texcoordB : TEXCOORD2,\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " uniform float4 texpad_txblur1,\n"
                 text += " uniform float4 texpad_txblur1,\n"
                 text += " out float4 l_texcoordBS : TEXCOORD3,\n"
                 text += " out float4 l_texcoordBS : TEXCOORD3,\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += " uniform float4 texpad_txssao2,\n"
                 text += " uniform float4 texpad_txssao2,\n"
                 text += " out float4 l_texcoordAO : TEXCOORD4,\n"
                 text += " out float4 l_texcoordAO : TEXCOORD4,\n"
             text += " uniform float4x4 mat_modelproj)\n"
             text += " uniform float4x4 mat_modelproj)\n"
             text += "{\n"
             text += "{\n"
             text += " l_position=mul(mat_modelproj, vtx_position);\n"
             text += " l_position=mul(mat_modelproj, vtx_position);\n"
             text += " l_texcoordC=(vtx_position.xzxz * texpad_txcolor) + texpad_txcolor;\n"
             text += " l_texcoordC=(vtx_position.xzxz * texpad_txcolor) + texpad_txcolor;\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += " l_texcoordN=(vtx_position.xzxz * texpad_txaux) + texpad_txaux;\n"
                 text += " l_texcoordN=(vtx_position.xzxz * texpad_txaux) + texpad_txaux;\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += " l_texcoordB=(vtx_position.xzxz * texpad_txbloom3) + texpad_txbloom3;\n"
                 text += " l_texcoordB=(vtx_position.xzxz * texpad_txbloom3) + texpad_txbloom3;\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " l_texcoordBS=(vtx_position.xzxz * texpad_txblur1) + texpad_txblur1;\n"
                 text += " l_texcoordBS=(vtx_position.xzxz * texpad_txblur1) + texpad_txblur1;\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += " l_texcoordAO=(vtx_position.xzxz * texpad_txssao2) + texpad_txssao2;\n"
                 text += " l_texcoordAO=(vtx_position.xzxz * texpad_txssao2) + texpad_txssao2;\n"
-            if (configuration.has_key("HalfPixelShift")):
+            if ("HalfPixelShift" in configuration):
                 text += " l_texcoordC+=texpix_txcolor*0.5;\n"
                 text += " l_texcoordC+=texpix_txcolor*0.5;\n"
-                if (configuration.has_key("CartoonInk")):
+                if ("CartoonInk" in configuration):
                     text += " l_texcoordN+=texpix_txaux*0.5;\n"
                     text += " l_texcoordN+=texpix_txaux*0.5;\n"
             text += "}\n"
             text += "}\n"
 
 
             text += "void fshader(\n"
             text += "void fshader(\n"
             text += "float4 l_texcoordC : TEXCOORD0,\n"
             text += "float4 l_texcoordC : TEXCOORD0,\n"
             text += "uniform float4 texpix_txcolor,\n"
             text += "uniform float4 texpix_txcolor,\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += "float4 l_texcoordN : TEXCOORD1,\n"
                 text += "float4 l_texcoordN : TEXCOORD1,\n"
                 text += "uniform float4 texpix_txaux,\n"
                 text += "uniform float4 texpix_txaux,\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += "float4 l_texcoordB : TEXCOORD2,\n"
                 text += "float4 l_texcoordB : TEXCOORD2,\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += "float4 l_texcoordBS : TEXCOORD3,\n"
                 text += "float4 l_texcoordBS : TEXCOORD3,\n"
                 text += "uniform float4 k_blurval,\n"
                 text += "uniform float4 k_blurval,\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += "float4 l_texcoordAO : TEXCOORD4,\n"
                 text += "float4 l_texcoordAO : TEXCOORD4,\n"
             for key in self.textures:
             for key in self.textures:
                 text += "uniform sampler2D k_tx" + key + ",\n"
                 text += "uniform sampler2D k_tx" + key + ",\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += "uniform float4 k_cartoonseparation,\n"
                 text += "uniform float4 k_cartoonseparation,\n"
                 text += "uniform float4 k_cartooncolor,\n"
                 text += "uniform float4 k_cartooncolor,\n"
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 text += "uniform float4 k_casterpos,\n"
                 text += "uniform float4 k_casterpos,\n"
                 text += "uniform float4 k_vlparams,\n"
                 text += "uniform float4 k_vlparams,\n"
             text += "out float4 o_color : COLOR)\n"
             text += "out float4 o_color : COLOR)\n"
             text += "{\n"
             text += "{\n"
             text += " o_color = tex2D(k_txcolor, l_texcoordC.xy);\n"
             text += " o_color = tex2D(k_txcolor, l_texcoordC.xy);\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += CARTOON_BODY
                 text += CARTOON_BODY
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += "o_color *= tex2D(k_txssao2, l_texcoordAO.xy).r;\n"
                 text += "o_color *= tex2D(k_txssao2, l_texcoordAO.xy).r;\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " o_color = lerp(tex2D(k_txblur1, l_texcoordBS.xy), o_color, k_blurval.x);\n"
                 text += " o_color = lerp(tex2D(k_txblur1, l_texcoordBS.xy), o_color, k_blurval.x);\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += "o_color = saturate(o_color);\n";
                 text += "o_color = saturate(o_color);\n";
                 text += "float4 bloom = 0.5*tex2D(k_txbloom3, l_texcoordB.xy);\n"
                 text += "float4 bloom = 0.5*tex2D(k_txbloom3, l_texcoordB.xy);\n"
                 text += "o_color = 1-((1-bloom)*(1-o_color));\n"
                 text += "o_color = 1-((1-bloom)*(1-o_color));\n"
-            if (configuration.has_key("ViewGlow")):
+            if ("ViewGlow" in configuration):
                 text += "o_color.r = o_color.a;\n"
                 text += "o_color.r = o_color.a;\n"
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 text += "float decay = 1.0f;\n"
                 text += "float decay = 1.0f;\n"
                 text += "float2 curcoord = l_texcoordC.xy;\n"
                 text += "float2 curcoord = l_texcoordC.xy;\n"
                 text += "float2 lightdir = curcoord - k_casterpos.xy;\n"
                 text += "float2 lightdir = curcoord - k_casterpos.xy;\n"
@@ -262,7 +262,7 @@ class CommonFilters:
                 text += "  decay *= k_vlparams.y;\n"
                 text += "  decay *= k_vlparams.y;\n"
                 text += "}\n"
                 text += "}\n"
                 text += "o_color += float4(vlcolor * k_vlparams.z, 1);\n"
                 text += "o_color += float4(vlcolor * k_vlparams.z, 1);\n"
-            if (configuration.has_key("Inverted")):
+            if ("Inverted" in configuration):
                 text += "o_color = float4(1, 1, 1, 1) - o_color;\n"
                 text += "o_color = float4(1, 1, 1, 1) - o_color;\n"
             text += "}\n"
             text += "}\n"
             
             
@@ -273,18 +273,18 @@ class CommonFilters:
             self.task = taskMgr.add(self.update, "common-filters-update")
             self.task = taskMgr.add(self.update, "common-filters-update")
         
         
         if (changed == "CartoonInk") or fullrebuild:
         if (changed == "CartoonInk") or fullrebuild:
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 c = configuration["CartoonInk"]
                 c = configuration["CartoonInk"]
                 self.finalQuad.setShaderInput("cartoonseparation", Vec4(c.separation, 0, c.separation, 0))
                 self.finalQuad.setShaderInput("cartoonseparation", Vec4(c.separation, 0, c.separation, 0))
                 self.finalQuad.setShaderInput("cartooncolor", c.color)
                 self.finalQuad.setShaderInput("cartooncolor", c.color)
 
 
         if (changed == "BlurSharpen") or fullrebuild:
         if (changed == "BlurSharpen") or fullrebuild:
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 blurval = configuration["BlurSharpen"]
                 blurval = configuration["BlurSharpen"]
                 self.finalQuad.setShaderInput("blurval", Vec4(blurval, blurval, blurval, blurval))
                 self.finalQuad.setShaderInput("blurval", Vec4(blurval, blurval, blurval, blurval))
 
 
         if (changed == "Bloom") or fullrebuild:
         if (changed == "Bloom") or fullrebuild:
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 bloomconf = configuration["Bloom"]
                 bloomconf = configuration["Bloom"]
                 intensity = bloomconf.intensity * 3.0
                 intensity = bloomconf.intensity * 3.0
                 self.bloom[0].setShaderInput("blend", bloomconf.blendx, bloomconf.blendy, bloomconf.blendz, bloomconf.blendw * 2.0)
                 self.bloom[0].setShaderInput("blend", bloomconf.blendx, bloomconf.blendy, bloomconf.blendz, bloomconf.blendw * 2.0)
@@ -293,13 +293,13 @@ class CommonFilters:
                 self.bloom[3].setShaderInput("intensity", intensity, intensity, intensity, intensity)
                 self.bloom[3].setShaderInput("intensity", intensity, intensity, intensity, intensity)
         
         
         if (changed == "VolumetricLighting") or fullrebuild:
         if (changed == "VolumetricLighting") or fullrebuild:
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 config = configuration["VolumetricLighting"]
                 config = configuration["VolumetricLighting"]
                 tcparam = config.density / float(config.numsamples)
                 tcparam = config.density / float(config.numsamples)
                 self.finalQuad.setShaderInput("vlparams", tcparam, config.decay, config.exposure, 0.0)
                 self.finalQuad.setShaderInput("vlparams", tcparam, config.decay, config.exposure, 0.0)
         
         
         if (changed == "AmbientOcclusion") or fullrebuild:
         if (changed == "AmbientOcclusion") or fullrebuild:
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 config = configuration["AmbientOcclusion"]
                 config = configuration["AmbientOcclusion"]
                 self.ssao[0].setShaderInput("params1", config.numsamples, -float(config.amount) / config.numsamples, config.radius, 0)
                 self.ssao[0].setShaderInput("params1", config.numsamples, -float(config.amount) / config.numsamples, config.radius, 0)
                 self.ssao[0].setShaderInput("params2", config.strength, config.falloff, 0, 0)
                 self.ssao[0].setShaderInput("params2", config.strength, config.falloff, 0, 0)
@@ -311,7 +311,7 @@ class CommonFilters:
         """Updates the shader inputs that need to be updated every frame.
         """Updates the shader inputs that need to be updated every frame.
         Normally, you shouldn't call this, it's being called in a task."""
         Normally, you shouldn't call this, it's being called in a task."""
 
 
-        if self.configuration.has_key("VolumetricLighting"):
+        if "VolumetricLighting" in self.configuration:
             caster = self.configuration["VolumetricLighting"].caster
             caster = self.configuration["VolumetricLighting"].caster
             casterpos = Point2()
             casterpos = Point2()
             self.manager.camera.node().getLens().project(caster.getPos(self.manager.camera), casterpos)
             self.manager.camera.node().getLens().project(caster.getPos(self.manager.camera), casterpos)
@@ -320,7 +320,7 @@ class CommonFilters:
             return task.cont
             return task.cont
 
 
     def setCartoonInk(self, separation=1, color=(0, 0, 0, 1)):
     def setCartoonInk(self, separation=1, color=(0, 0, 0, 1)):
-        fullrebuild = (self.configuration.has_key("CartoonInk") == False)
+        fullrebuild = (("CartoonInk" in self.configuration) == False)
         newconfig = FilterConfig()
         newconfig = FilterConfig()
         newconfig.separation = separation
         newconfig.separation = separation
         newconfig.color = color
         newconfig.color = color
@@ -328,7 +328,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "CartoonInk")
         return self.reconfigure(fullrebuild, "CartoonInk")
 
 
     def delCartoonInk(self):
     def delCartoonInk(self):
-        if (self.configuration.has_key("CartoonInk")):
+        if ("CartoonInk" in self.configuration):
             del self.configuration["CartoonInk"]
             del self.configuration["CartoonInk"]
             return self.reconfigure(True, "CartoonInk")
             return self.reconfigure(True, "CartoonInk")
         return True
         return True
@@ -357,40 +357,40 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "Bloom")
         return self.reconfigure(fullrebuild, "Bloom")
 
 
     def delBloom(self):
     def delBloom(self):
-        if (self.configuration.has_key("Bloom")):
+        if ("Bloom" in self.configuration):
             del self.configuration["Bloom"]
             del self.configuration["Bloom"]
             return self.reconfigure(True, "Bloom")
             return self.reconfigure(True, "Bloom")
         return True
         return True
 
 
     def setHalfPixelShift(self):
     def setHalfPixelShift(self):
-        fullrebuild = (self.configuration.has_key("HalfPixelShift") == False)
+        fullrebuild = (("HalfPixelShift" in self.configuration) == False)
         self.configuration["HalfPixelShift"] = 1
         self.configuration["HalfPixelShift"] = 1
         return self.reconfigure(fullrebuild, "HalfPixelShift")
         return self.reconfigure(fullrebuild, "HalfPixelShift")
 
 
     def delHalfPixelShift(self):
     def delHalfPixelShift(self):
-        if (self.configuration.has_key("HalfPixelShift")):
+        if ("HalfPixelShift" in self.configuration):
             del self.configuration["HalfPixelShift"]
             del self.configuration["HalfPixelShift"]
             return self.reconfigure(True, "HalfPixelShift")
             return self.reconfigure(True, "HalfPixelShift")
         return True
         return True
 
 
     def setViewGlow(self):
     def setViewGlow(self):
-        fullrebuild = (self.configuration.has_key("ViewGlow") == False)
+        fullrebuild = (("ViewGlow" in self.configuration) == False)
         self.configuration["ViewGlow"] = 1
         self.configuration["ViewGlow"] = 1
         return self.reconfigure(fullrebuild, "ViewGlow")
         return self.reconfigure(fullrebuild, "ViewGlow")
 
 
     def delViewGlow(self):
     def delViewGlow(self):
-        if (self.configuration.has_key("ViewGlow")):
+        if ("ViewGlow" in self.configuration):
             del self.configuration["ViewGlow"]
             del self.configuration["ViewGlow"]
             return self.reconfigure(True, "ViewGlow")
             return self.reconfigure(True, "ViewGlow")
         return True
         return True
 
 
     def setInverted(self):
     def setInverted(self):
-        fullrebuild = (self.configuration.has_key("Inverted") == False)
+        fullrebuild = (("Inverted" in self.configuration) == False)
         self.configuration["Inverted"] = 1
         self.configuration["Inverted"] = 1
         return self.reconfigure(fullrebuild, "Inverted")
         return self.reconfigure(fullrebuild, "Inverted")
 
 
     def delInverted(self):
     def delInverted(self):
-        if (self.configuration.has_key("Inverted")):
+        if ("Inverted" in self.configuration):
             del self.configuration["Inverted"]
             del self.configuration["Inverted"]
             return self.reconfigure(True, "Inverted")
             return self.reconfigure(True, "Inverted")
         return True
         return True
@@ -411,7 +411,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "VolumetricLighting")
         return self.reconfigure(fullrebuild, "VolumetricLighting")
 
 
     def delVolumetricLighting(self):
     def delVolumetricLighting(self):
-        if (self.configuration.has_key("VolumetricLighting")):
+        if ("VolumetricLighting" in self.configuration):
             del self.configuration["VolumetricLighting"]
             del self.configuration["VolumetricLighting"]
             return self.reconfigure(True, "VolumetricLighting")
             return self.reconfigure(True, "VolumetricLighting")
         return True
         return True
@@ -419,18 +419,18 @@ class CommonFilters:
     def setBlurSharpen(self, amount=0.0):
     def setBlurSharpen(self, amount=0.0):
         """Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have effect.
         """Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have effect.
         A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image."""
         A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image."""
-        fullrebuild = (self.configuration.has_key("BlurSharpen") == False)
+        fullrebuild = (("BlurSharpen" in self.configuration) == False)
         self.configuration["BlurSharpen"] = amount
         self.configuration["BlurSharpen"] = amount
         return self.reconfigure(fullrebuild, "BlurSharpen")
         return self.reconfigure(fullrebuild, "BlurSharpen")
 
 
     def delBlurSharpen(self):
     def delBlurSharpen(self):
-        if (self.configuration.has_key("BlurSharpen")):
+        if ("BlurSharpen" in self.configuration):
             del self.configuration["BlurSharpen"]
             del self.configuration["BlurSharpen"]
             return self.reconfigure(True, "BlurSharpen")
             return self.reconfigure(True, "BlurSharpen")
         return True
         return True
 
 
     def setAmbientOcclusion(self, numsamples = 16, radius = 0.05, amount = 2.0, strength = 0.01, falloff = 0.000002):
     def setAmbientOcclusion(self, numsamples = 16, radius = 0.05, amount = 2.0, strength = 0.01, falloff = 0.000002):
-        fullrebuild = (self.configuration.has_key("AmbientOcclusion") == False)
+        fullrebuild = (("AmbientOcclusion" in self.configuration) == False)
         newconfig = FilterConfig()
         newconfig = FilterConfig()
         newconfig.numsamples = numsamples
         newconfig.numsamples = numsamples
         newconfig.radius = radius
         newconfig.radius = radius
@@ -441,7 +441,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "AmbientOcclusion")
         return self.reconfigure(fullrebuild, "AmbientOcclusion")
 
 
     def delAmbientOcclusion(self):
     def delAmbientOcclusion(self):
-        if (self.configuration.has_key("AmbientOcclusion")):
+        if ("AmbientOcclusion" in self.configuration):
             del self.configuration["AmbientOcclusion"]
             del self.configuration["AmbientOcclusion"]
             return self.reconfigure(True, "AmbientOcclusion")
             return self.reconfigure(True, "AmbientOcclusion")
         return True
         return True

+ 3 - 3
direct/src/gui/DirectDialog.py

@@ -15,7 +15,7 @@ def findDialog(uniqueName):
     useful for debugging, to get a pointer to the current onscreen
     useful for debugging, to get a pointer to the current onscreen
     panel of a particular type.
     panel of a particular type.
     """
     """
-    if DirectDialog.AllDialogs.has_key(uniqueName):
+    if uniqueName in DirectDialog.AllDialogs:
         return DirectDialog.AllDialogs[uniqueName]
         return DirectDialog.AllDialogs[uniqueName]
     return None
     return None
 
 
@@ -27,7 +27,7 @@ def cleanupDialog(uniqueName):
     that opening panel A should automatically close panel B, for
     that opening panel A should automatically close panel B, for
     instance.
     instance.
     """
     """
-    if DirectDialog.AllDialogs.has_key(uniqueName):
+    if uniqueName in DirectDialog.AllDialogs:
         # calling cleanup() will remove it out of the AllDialogs dict
         # calling cleanup() will remove it out of the AllDialogs dict
         # This way it will get removed from the dict even it we did
         # This way it will get removed from the dict even it we did
         # not clean it up using this interface (ie somebody called
         # not clean it up using this interface (ie somebody called
@@ -330,7 +330,7 @@ class DirectDialog(DirectFrame):
     def cleanup(self):
     def cleanup(self):
         # Remove this panel out of the AllDialogs list
         # Remove this panel out of the AllDialogs list
         uniqueName = self['dialogName']
         uniqueName = self['dialogName']
-        if DirectDialog.AllDialogs.has_key(uniqueName):
+        if uniqueName in DirectDialog.AllDialogs:
             del DirectDialog.AllDialogs[uniqueName]
             del DirectDialog.AllDialogs[uniqueName]
         self.destroy()
         self.destroy()
 
 

+ 5 - 5
direct/src/gui/DirectGuiBase.py

@@ -439,7 +439,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         Get current configuration setting for this option
         Get current configuration setting for this option
         """
         """
         # Return the value of an option, for example myWidget['font'].
         # Return the value of an option, for example myWidget['font'].
-        if self._optionInfo.has_key(option):
+        if option in self._optionInfo:
             return self._optionInfo[option][DGG._OPT_VALUE]
             return self._optionInfo[option][DGG._OPT_VALUE]
         else:
         else:
             index = string.find(option, '_')
             index = string.find(option, '_')
@@ -448,7 +448,7 @@ class DirectGuiBase(DirectObject.DirectObject):
                 componentOption = option[(index + 1):]
                 componentOption = option[(index + 1):]
 
 
                 # Expand component alias
                 # Expand component alias
-                if self.__componentAliases.has_key(component):
+                if component in self.__componentAliases:
                     component, subComponent = self.__componentAliases[
                     component, subComponent = self.__componentAliases[
                         component]
                         component]
                     if subComponent is not None:
                     if subComponent is not None:
@@ -457,7 +457,7 @@ class DirectGuiBase(DirectObject.DirectObject):
                     # Expand option string to write on error
                     # Expand option string to write on error
                     option = component + '_' + componentOption
                     option = component + '_' + componentOption
 
 
-                if self.__componentInfo.has_key(component):
+                if component in self.__componentInfo:
                     # Call cget on the component.
                     # Call cget on the component.
                     componentCget = self.__componentInfo[component][3]
                     componentCget = self.__componentInfo[component][3]
                     return componentCget(componentOption)
                     return componentCget(componentOption)
@@ -582,7 +582,7 @@ class DirectGuiBase(DirectObject.DirectObject):
 
 
         # Expand component alias
         # Expand component alias
         # Example entry which is an alias for entryField_entry
         # Example entry which is an alias for entryField_entry
-        if self.__componentAliases.has_key(component):
+        if component in self.__componentAliases:
             # component = entryField, subComponent = entry
             # component = entryField, subComponent = entry
             component, subComponent = self.__componentAliases[component]
             component, subComponent = self.__componentAliases[component]
             if subComponent is not None:
             if subComponent is not None:
@@ -608,7 +608,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         return names
         return names
 
 
     def hascomponent(self, component):
     def hascomponent(self, component):
-        return self.__componentInfo.has_key(component)
+        return component in self.__componentInfo
 
 
     def destroycomponent(self, name):
     def destroycomponent(self, name):
         # Remove a megawidget component.
         # Remove a megawidget component.

+ 1 - 1
direct/src/gui/DirectGuiTest.py

@@ -124,7 +124,7 @@ if __name__ == "__main__":
                               command = printDialogValue)
                               command = printDialogValue)
 
 
     customDialog = DirectDialog(text = 'Pick a number',
     customDialog = DirectDialog(text = 'Pick a number',
-                                buttonTextList = map(str, range(10)),
+                                buttonTextList = [str(i) for i in range(10)],
                                 buttonValueList = range(10),
                                 buttonValueList = range(10),
                                 command = printDialogValue)
                                 command = printDialogValue)
 
 

+ 3 - 3
direct/src/gui/DirectScrolledList.py

@@ -22,10 +22,10 @@ class DirectScrolledListItem(DirectButton):
     def __init__(self, parent=None, **kw):
     def __init__(self, parent=None, **kw):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         self.parent = parent
         self.parent = parent
-        if kw.has_key("command"):
+        if "command" in kw:
             self.nextCommand = kw.get("command")
             self.nextCommand = kw.get("command")
             del kw["command"]
             del kw["command"]
-        if kw.has_key("extraArgs"):
+        if "extraArgs" in kw:
             self.nextCommandExtraArgs = kw.get("extraArgs")
             self.nextCommandExtraArgs = kw.get("extraArgs")
             del kw["extraArgs"]
             del kw["extraArgs"]
         optiondefs = (
         optiondefs = (
@@ -59,7 +59,7 @@ class DirectScrolledList(DirectFrame):
 
 
         # if 'items' is a list of strings, make a copy for our use
         # if 'items' is a list of strings, make a copy for our use
         # so we can modify it without mangling the user's list
         # so we can modify it without mangling the user's list
-        if kw.has_key('items'):
+        if 'items' in kw:
             for item in kw['items']:
             for item in kw['items']:
                 if type(item) != type(''):
                 if type(item) != type(''):
                     break
                     break

+ 1 - 1
direct/src/gui/DirectWaitBar.py

@@ -35,7 +35,7 @@ class DirectWaitBar(DirectFrame):
             ('barRelief',      DGG.FLAT,           self.setBarRelief),
             ('barRelief',      DGG.FLAT,           self.setBarRelief),
             ('sortOrder',      NO_FADE_SORT_INDEX, None),
             ('sortOrder',      NO_FADE_SORT_INDEX, None),
             )
             )
-        if kw.has_key('text'):
+        if 'text' in kw:
             textoptiondefs = (
             textoptiondefs = (
                 ('text_pos',    (0, -0.025),          None),
                 ('text_pos',    (0, -0.025),          None),
                 ('text_scale',  0.1,                 None)
                 ('text_scale',  0.1,                 None)

+ 1 - 1
direct/src/http/WebRequest.py

@@ -262,7 +262,7 @@ class WebRequestDispatcher(object):
 
 
     def enableLandingPage(self, enable):
     def enableLandingPage(self, enable):
         if enable:
         if enable:
-            if not self.__dict__.has_key("landingPage"):
+            if "landingPage" not in self.__dict__:
                 self.landingPage = LandingPage()
                 self.landingPage = LandingPage()
                 self.registerGETHandler("/", self._main, returnsResponse = True, autoSkin = True)
                 self.registerGETHandler("/", self._main, returnsResponse = True, autoSkin = True)
                 self.registerGETHandler("/services", self._services, returnsResponse = True, autoSkin = True)
                 self.registerGETHandler("/services", self._services, returnsResponse = True, autoSkin = True)

+ 3 - 3
direct/src/http/webAIInspector.py

@@ -292,7 +292,7 @@ def inspectObject(anObject):
 
 
 def inspectorFor(anObject):
 def inspectorFor(anObject):
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
-    if _InspectorMap.has_key(typeName):
+    if typeName in _InspectorMap:
         inspectorName = _InspectorMap[typeName]
         inspectorName = _InspectorMap[typeName]
     else:
     else:
         print "Can't find an inspector for " + typeName
         print "Can't find an inspector for " + typeName
@@ -355,7 +355,7 @@ class Inspector:
             #    self._partsList.append(each)  
             #    self._partsList.append(each)  
 
 
     def initializePartNames(self):
     def initializePartNames(self):
-        self._partNames = ['up'] + map(lambda each: str(each), self._partsList)
+        self._partNames = ['up'] + [str(each) for each in self._partsList]
 
 
     def title(self):
     def title(self):
         "Subclasses may override."
         "Subclasses may override."
@@ -458,7 +458,7 @@ class DictionaryInspector(Inspector):
         if partNumber == 0:
         if partNumber == 0:
             return self.object
             return self.object
         key = self.privatePartNumber(partNumber)
         key = self.privatePartNumber(partNumber)
-        if self.object.has_key(key):
+        if key in self.object:
             return self.object[key]
             return self.object[key]
         else:
         else:
             return getattr(self.object, key)
             return getattr(self.object, key)

+ 4 - 4
direct/src/interval/MetaInterval.py

@@ -38,7 +38,7 @@ class MetaInterval(CMetaInterval):
         #else:
         #else:
 
 
         # Look for the name in the keyword params.
         # Look for the name in the keyword params.
-        if kw.has_key('name'):
+        if 'name' in kw:
             name = kw['name']
             name = kw['name']
             del kw['name']
             del kw['name']
 
 
@@ -52,10 +52,10 @@ class MetaInterval(CMetaInterval):
         
         
         autoPause = 0
         autoPause = 0
         autoFinish = 0
         autoFinish = 0
-        if kw.has_key('autoPause'):
+        if 'autoPause' in kw:
             autoPause = kw['autoPause']
             autoPause = kw['autoPause']
             del kw['autoPause']
             del kw['autoPause']
-        if kw.has_key('autoFinish'):
+        if 'autoFinish' in kw:
             autoFinish = kw['autoFinish']
             autoFinish = kw['autoFinish']
             del kw['autoFinish']
             del kw['autoFinish']
 
 
@@ -63,7 +63,7 @@ class MetaInterval(CMetaInterval):
         # appear to have for the purposes of computing the start time
         # appear to have for the purposes of computing the start time
         # for subsequent intervals in a sequence or track.
         # for subsequent intervals in a sequence or track.
         self.phonyDuration = -1
         self.phonyDuration = -1
-        if kw.has_key('duration'):
+        if 'duration' in kw:
             self.phonyDuration = kw['duration']
             self.phonyDuration = kw['duration']
             del kw['duration']
             del kw['duration']
 
 

+ 3 - 3
direct/src/leveleditor/ObjectPropertyUI.py

@@ -91,7 +91,7 @@ class ObjectPropUI(wx.Panel):
             value = self.getValue()
             value = self.getValue()
             frame = self.parent.editor.ui.animUI.curFrame
             frame = self.parent.editor.ui.animUI.curFrame
             
             
-            if self.parent.editor.animMgr.keyFramesInfo.has_key((objUID,propertyName)):
+            if (objUID, propertyName) in self.parent.editor.animMgr.keyFramesInfo:
                 for i in range(len(self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)])):
                 for i in range(len(self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)])):
                     if self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i][AG.FRAME] == frame:
                     if self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i][AG.FRAME] == frame:
                         del self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i]
                         del self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i]
@@ -239,8 +239,8 @@ class ObjectPropUITime(wx.Panel):
 
 
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
         self.uiAmPm = wx.Choice(self.uiPane, -1, choices=['AM', 'PM'])
         self.uiAmPm = wx.Choice(self.uiPane, -1, choices=['AM', 'PM'])
-        self.uiHour = wx.Choice(self.uiPane, -1, choices=map(lambda x : str(x), range(1, 13)))
-        self.uiMin = wx.Choice(self.uiPane, -1, choices=map(lambda x : str(x), range(0, 60, 15)))
+        self.uiHour = wx.Choice(self.uiPane, -1, choices=[str(x) for x in range(1, 13)])
+        self.uiMin = wx.Choice(self.uiPane, -1, choices=[str(x) for x in range(0, 60, 15)])
 
 
         hSizer.Add(self.uiAmPm)
         hSizer.Add(self.uiAmPm)
         hSizer.Add(self.uiHour)
         hSizer.Add(self.uiHour)

+ 7 - 7
direct/src/p3d/DeploymentTools.py

@@ -39,9 +39,9 @@ def archiveFilter(info):
     # Somewhat hacky, but it's the only way
     # Somewhat hacky, but it's the only way
     # permissions can work on a Windows box.
     # permissions can work on a Windows box.
     if info.type != tarfile.DIRTYPE and '.' in info.name.rsplit('/', 1)[-1]:
     if info.type != tarfile.DIRTYPE and '.' in info.name.rsplit('/', 1)[-1]:
-        info.mode = 0644
+        info.mode = 0o644
     else:
     else:
-        info.mode = 0755
+        info.mode = 0o755
 
 
     return info
     return info
 
 
@@ -53,8 +53,8 @@ class TarInfoRoot(tarfile.TarInfo):
     gid = property(lambda self: 0, lambda self, x: None)
     gid = property(lambda self: 0, lambda self, x: None)
     uname = property(lambda self: "root", lambda self, x: None)
     uname = property(lambda self: "root", lambda self, x: None)
     gname = property(lambda self: "root", lambda self, x: None)
     gname = property(lambda self: "root", lambda self, x: None)
-    mode = property(lambda self: 0644 if self.type != tarfile.DIRTYPE and \
-                    '.' in self.name.rsplit('/', 1)[-1] else 0755,
+    mode = property(lambda self: 0o644 if self.type != tarfile.DIRTYPE and \
+                    '.' in self.name.rsplit('/', 1)[-1] else 0o755,
                     lambda self, x: None)
                     lambda self, x: None)
 
 
 # On OSX, the root group is named "wheel".
 # On OSX, the root group is named "wheel".
@@ -186,7 +186,7 @@ class Standalone:
         ohandle.close()
         ohandle.close()
         phandle.close()
         phandle.close()
 
 
-        os.chmod(output.toOsSpecific(), 0755)
+        os.chmod(output.toOsSpecific(), 0o755)
 
 
     def getExtraFiles(self, platform):
     def getExtraFiles(self, platform):
         """ Returns a list of extra files that will need to be included
         """ Returns a list of extra files that will need to be included
@@ -550,7 +550,7 @@ class Installer:
                 mf = Multifile()
                 mf = Multifile()
                 # Make sure that it isn't mounted before altering it, just to be safe
                 # Make sure that it isn't mounted before altering it, just to be safe
                 vfs.unmount(archive)
                 vfs.unmount(archive)
-                os.chmod(archive.toOsSpecific(), 0644)
+                os.chmod(archive.toOsSpecific(), 0o644)
                 if not mf.openReadWrite(archive):
                 if not mf.openReadWrite(archive):
                     Installer.notify.warning("Failed to open archive %s" % (archive))
                     Installer.notify.warning("Failed to open archive %s" % (archive))
                     continue
                     continue
@@ -575,7 +575,7 @@ class Installer:
                 #    archive.unlink()
                 #    archive.unlink()
                 #else:
                 #else:
                 mf.close()
                 mf.close()
-                try: os.chmod(archive.toOsSpecific(), 0444)
+                try: os.chmod(archive.toOsSpecific(), 0o444)
                 except: pass
                 except: pass
 
 
         # Write out our own contents.xml file.
         # Write out our own contents.xml file.

+ 2 - 2
direct/src/p3d/FileSpec.py

@@ -205,9 +205,9 @@ class FileSpec:
         # On Windows, we have to change the file to read-write before
         # On Windows, we have to change the file to read-write before
         # we can successfully update its timestamp.
         # we can successfully update its timestamp.
         try:
         try:
-            os.chmod(pathname.toOsSpecific(), 0755)
+            os.chmod(pathname.toOsSpecific(), 0o755)
             os.utime(pathname.toOsSpecific(), (st.st_atime, self.timestamp))
             os.utime(pathname.toOsSpecific(), (st.st_atime, self.timestamp))
-            os.chmod(pathname.toOsSpecific(), 0555)
+            os.chmod(pathname.toOsSpecific(), 0o555)
         except OSError:
         except OSError:
             pass
             pass
 
 

+ 6 - 6
direct/src/p3d/PackageInfo.py

@@ -175,7 +175,7 @@ class PackageInfo:
 
 
         # Return the size of plan A, assuming it will work.
         # Return the size of plan A, assuming it will work.
         plan = self.installPlans[0]
         plan = self.installPlans[0]
-        size = sum(map(lambda step: step.getEffort(), plan))
+        size = sum([step.getEffort() for step in plan])
         
         
         return size
         return size
 
 
@@ -313,7 +313,7 @@ class PackageInfo:
 
 
             filename = Filename(self.getPackageDir(), self.descFileBasename)
             filename = Filename(self.getPackageDir(), self.descFileBasename)
             # Now that we've written the desc file, make it read-only.
             # Now that we've written the desc file, make it read-only.
-            os.chmod(filename.toOsSpecific(), 0444)
+            os.chmod(filename.toOsSpecific(), 0o444)
 
 
         if not self.__readDescFile():
         if not self.__readDescFile():
             # Weird, it passed the hash check, but we still can't read
             # Weird, it passed the hash check, but we still can't read
@@ -688,7 +688,7 @@ class PackageInfo:
         installPlans = self.installPlans
         installPlans = self.installPlans
         self.installPlans = None
         self.installPlans = None
         for plan in installPlans:
         for plan in installPlans:
-            self.totalPlanSize = sum(map(lambda step: step.getEffort(), plan))
+            self.totalPlanSize = sum([step.getEffort() for step in plan])
             self.totalPlanCompleted = 0
             self.totalPlanCompleted = 0
             self.downloadProgress = 0
             self.downloadProgress = 0
 
 
@@ -832,7 +832,7 @@ class PackageInfo:
             if bytesStarted:
             if bytesStarted:
                 self.notify.info("Resuming %s after %s bytes already downloaded" % (url, bytesStarted))
                 self.notify.info("Resuming %s after %s bytes already downloaded" % (url, bytesStarted))
                 # Make sure the file is writable.
                 # Make sure the file is writable.
-                os.chmod(targetPathname.toOsSpecific(), 0644)
+                os.chmod(targetPathname.toOsSpecific(), 0o644)
                 channel.beginGetSubdocument(request, bytesStarted, 0)
                 channel.beginGetSubdocument(request, bytesStarted, 0)
             else:
             else:
                 # No partial download possible; get the whole file.
                 # No partial download possible; get the whole file.
@@ -980,7 +980,7 @@ class PackageInfo:
             yield self.stepFailed; return
             yield self.stepFailed; return
 
 
         # Now that we've verified the archive, make it read-only.
         # Now that we've verified the archive, make it read-only.
-        os.chmod(targetPathname.toOsSpecific(), 0444)
+        os.chmod(targetPathname.toOsSpecific(), 0o444)
 
 
         # Now we can safely remove the compressed archive.
         # Now we can safely remove the compressed archive.
         sourcePathname.unlink()
         sourcePathname.unlink()
@@ -1032,7 +1032,7 @@ class PackageInfo:
                 continue
                 continue
 
 
             # Make sure it's executable, and not writable.
             # Make sure it's executable, and not writable.
-            os.chmod(targetPathname.toOsSpecific(), 0555)
+            os.chmod(targetPathname.toOsSpecific(), 0o555)
 
 
             step.bytesDone += file.size
             step.bytesDone += file.size
             self.__updateStepProgress(step)
             self.__updateStepProgress(step)

+ 5 - 5
direct/src/p3d/Packager.py

@@ -427,7 +427,7 @@ class Packager:
                 self.compressionLevel = 6
                 self.compressionLevel = 6
 
 
                 # Every p3dapp requires panda3d.
                 # Every p3dapp requires panda3d.
-                if 'panda3d' not in map(lambda p: p.packageName, self.requires):
+                if 'panda3d' not in [p.packageName for p in self.requires]:
                     assert not self.packager.currentPackage
                     assert not self.packager.currentPackage
                     self.packager.currentPackage = self
                     self.packager.currentPackage = self
                     self.packager.do_require('panda3d')
                     self.packager.do_require('panda3d')
@@ -726,7 +726,7 @@ class Packager:
             if self.p3dApplication:
             if self.p3dApplication:
                 # No patches for an application; just move it into place.
                 # No patches for an application; just move it into place.
                 # Make the application file executable.
                 # Make the application file executable.
-                os.chmod(self.packageFullpath.toOsSpecific(), 0755)
+                os.chmod(self.packageFullpath.toOsSpecific(), 0o755)
             else:
             else:
                 self.readDescFile()
                 self.readDescFile()
                 self.packageSeq += 1
                 self.packageSeq += 1
@@ -2206,7 +2206,7 @@ class Packager:
         # returned, so they will persist beyond the lifespan of the
         # returned, so they will persist beyond the lifespan of the
         # config variable.
         # config variable.
         cvar = ConfigVariableSearchPath('pdef-path')
         cvar = ConfigVariableSearchPath('pdef-path')
-        self.installSearch = map(Filename, cvar.getDirectories())
+        self.installSearch = list(map(Filename, cvar.getDirectories()))
 
 
         # The system PATH, for searching dll's and exe's.
         # The system PATH, for searching dll's and exe's.
         self.executablePath = DSearchPath()
         self.executablePath = DSearchPath()
@@ -2938,7 +2938,7 @@ class Packager:
             tuples.append((version, file))
             tuples.append((version, file))
         tuples.sort(reverse = True)
         tuples.sort(reverse = True)
 
 
-        return map(lambda t: t[1], tuples)
+        return [t[1] for t in tuples]
 
 
     def __sortPackageInfos(self, packages):
     def __sortPackageInfos(self, packages):
         """ Given a list of PackageInfos retrieved from a Host, sorts
         """ Given a list of PackageInfos retrieved from a Host, sorts
@@ -2951,7 +2951,7 @@ class Packager:
             tuples.append((version, file))
             tuples.append((version, file))
         tuples.sort(reverse = True)
         tuples.sort(reverse = True)
 
 
-        return map(lambda t: t[1], tuples)
+        return [t[1] for t in tuples]
 
 
     def __makeVersionTuple(self, version):
     def __makeVersionTuple(self, version):
         """ Converts a version string into a tuple for sorting, by
         """ Converts a version string into a tuple for sorting, by

+ 1 - 1
direct/src/p3d/packp3d.py

@@ -204,7 +204,7 @@ def makePackedApp(args):
         # Pre-require panda3d, to give a less-confusing error message
         # Pre-require panda3d, to give a less-confusing error message
         # if one of our requirements pulls in a wrong version of
         # if one of our requirements pulls in a wrong version of
         # panda3d.
         # panda3d.
-        if 'panda3d' not in map(lambda t: t[0], requires):
+        if 'panda3d' not in [t[0] for t in requires]:
             packager.do_require('panda3d')
             packager.do_require('panda3d')
         
         
         for name, version, host in requires:
         for name, version, host in requires:

+ 1 - 1
direct/src/plugin_installer/make_installer.py

@@ -441,7 +441,7 @@ def makeInstaller():
         if not os.path.exists(dst_panda3dapp): os.makedirs(os.path.dirname(dst_panda3dapp))
         if not os.path.exists(dst_panda3dapp): os.makedirs(os.path.dirname(dst_panda3dapp))
         shutil.copytree(pluginFiles[npapi], dst_npapi)
         shutil.copytree(pluginFiles[npapi], dst_npapi)
         shutil.copyfile(pluginFiles[panda3d], dst_panda3d)
         shutil.copyfile(pluginFiles[panda3d], dst_panda3d)
-        os.chmod(dst_panda3d, 0755)
+        os.chmod(dst_panda3d, 0o755)
         shutil.copytree(pluginFiles[panda3dapp], dst_panda3dapp)
         shutil.copytree(pluginFiles[panda3dapp], dst_panda3dapp)
         
         
         tmpresdir = tempfile.mktemp('', 'p3d-resources')
         tmpresdir = tempfile.mktemp('', 'p3d-resources')

+ 1 - 1
direct/src/plugin_standalone/make_osx_bundle.py

@@ -73,7 +73,7 @@ def makeBundle(startDir):
     shutil.copyfile(icons.toOsSpecific(), iconFilename.toOsSpecific())
     shutil.copyfile(icons.toOsSpecific(), iconFilename.toOsSpecific())
     print panda3d_mac, exeFilename
     print panda3d_mac, exeFilename
     shutil.copyfile(panda3d_mac.toOsSpecific(), exeFilename.toOsSpecific())
     shutil.copyfile(panda3d_mac.toOsSpecific(), exeFilename.toOsSpecific())
-    os.chmod(exeFilename.toOsSpecific(), 0755)
+    os.chmod(exeFilename.toOsSpecific(), 0o755)
 
 
     # All done!
     # All done!
     bundleFilename.touch()
     bundleFilename.touch()

+ 1 - 1
direct/src/pyinst/finder.py

@@ -96,7 +96,7 @@ def identify(name, xtrapath=None):
     else:
     else:
         if xtrapath is None:
         if xtrapath is None:
             xtra = []
             xtra = []
-        elif _pcache.has_key(id(xtrapath)):
+        elif id(xtrapath) in _pcache:
             xtra = _pcache[id(xtrapath)]
             xtra = _pcache[id(xtrapath)]
         else:
         else:
             xtra = expand(xtrapath)
             xtra = expand(xtrapath)

+ 6 - 6
direct/src/pyinst/modulefinder.py

@@ -218,7 +218,7 @@ class ModuleFinder:
         else:
         else:
             self.msgout(3, "import_module ->", m)
             self.msgout(3, "import_module ->", m)
             return m
             return m
-        if self.badmodules.has_key(fqname):
+        if fqname in self.badmodules:
             self.msgout(3, "import_module -> None")
             self.msgout(3, "import_module -> None")
             self.badmodules[fqname][parent.__name__] = None
             self.badmodules[fqname][parent.__name__] = None
             return None
             return None
@@ -275,24 +275,24 @@ class ModuleFinder:
                 i = i+2
                 i = i+2
             if op == IMPORT_NAME:
             if op == IMPORT_NAME:
                 name = lastname = co.co_names[oparg]
                 name = lastname = co.co_names[oparg]
-                if not self.badmodules.has_key(lastname):
+                if lastname not in self.badmodules:
                     try:
                     try:
                         self.import_hook(name, m)
                         self.import_hook(name, m)
                     except ImportError, msg:
                     except ImportError, msg:
                         self.msg(2, "ImportError:", str(msg))
                         self.msg(2, "ImportError:", str(msg))
-                        if not self.badmodules.has_key(name):
+                        if name not in self.badmodules:
                             self.badmodules[name] = {}
                             self.badmodules[name] = {}
                         self.badmodules[name][m.__name__] = None
                         self.badmodules[name][m.__name__] = None
             elif op == IMPORT_FROM:
             elif op == IMPORT_FROM:
                 name = co.co_names[oparg]
                 name = co.co_names[oparg]
                 assert lastname is not None
                 assert lastname is not None
-                if not self.badmodules.has_key(lastname):
+                if lastname not in self.badmodules:
                     try:
                     try:
                         self.import_hook(lastname, m, [name])
                         self.import_hook(lastname, m, [name])
                     except ImportError, msg:
                     except ImportError, msg:
                         self.msg(2, "ImportError:", str(msg))
                         self.msg(2, "ImportError:", str(msg))
                         fullname = lastname + "." + name
                         fullname = lastname + "." + name
-                        if not self.badmodules.has_key(fullname):
+                        if fullname not in self.badmodules:
                             self.badmodules[fullname] = {}
                             self.badmodules[fullname] = {}
                         self.badmodules[fullname][m.__name__] = None
                         self.badmodules[fullname][m.__name__] = None
             else:
             else:
@@ -316,7 +316,7 @@ class ModuleFinder:
         return m
         return m
 
 
     def add_module(self, fqname):
     def add_module(self, fqname):
-        if self.modules.has_key(fqname):
+        if fqname in self.modules:
             return self.modules[fqname]
             return self.modules[fqname]
         self.modules[fqname] = m = Module(fqname)
         self.modules[fqname] = m = Module(fqname)
         return m
         return m

+ 1 - 1
direct/src/pyinst/resource.py

@@ -18,7 +18,7 @@ def makeresource(name, xtrapath=None):
        when the module archive.py was desired."""
        when the module archive.py was desired."""
     typ, nm, fullname = finder.identify(name, xtrapath)
     typ, nm, fullname = finder.identify(name, xtrapath)
     fullname = os.path.normpath(fullname)
     fullname = os.path.normpath(fullname)
-    if _cache.has_key(fullname):
+    if fullname in _cache:
         return _cache[fullname]
         return _cache[fullname]
     elif typ in (finder.SCRIPT, finder.GSCRIPT):
     elif typ in (finder.SCRIPT, finder.GSCRIPT):
         rsrc = scriptresource(nm, fullname)
         rsrc = scriptresource(nm, fullname)

+ 3 - 3
direct/src/showbase/Audio3DManager.py

@@ -139,7 +139,7 @@ class Audio3DManager:
         """
         """
         Get the velocity of the sound.
         Get the velocity of the sound.
         """
         """
-        if (self.vel_dict.has_key(sound)):
+        if (sound in self.vel_dict):
             vel = self.vel_dict[sound]
             vel = self.vel_dict[sound]
             if (vel!=None):
             if (vel!=None):
                 return vel
                 return vel
@@ -196,7 +196,7 @@ class Audio3DManager:
                     # the object any more
                     # the object any more
                     del self.sound_dict[known_object]
                     del self.sound_dict[known_object]
 
 
-        if not self.sound_dict.has_key(object):
+        if object not in self.sound_dict:
             self.sound_dict[object] = []
             self.sound_dict[object] = []
 
 
         self.sound_dict[object].append(sound)
         self.sound_dict[object].append(sound)
@@ -222,7 +222,7 @@ class Audio3DManager:
         """
         """
         returns a list of sounds attached to an object
         returns a list of sounds attached to an object
         """
         """
-        if not self.sound_dict.has_key(object):
+        if object not in self.sound_dict:
             return []
             return []
         sound_list = []
         sound_list = []
         sound_list.extend(self.sound_dict[object])
         sound_list.extend(self.sound_dict[object])

+ 1 - 1
direct/src/showbase/Factory.py

@@ -20,7 +20,7 @@ class Factory:
         return self._type2ctor[type](*args, **kwArgs)
         return self._type2ctor[type](*args, **kwArgs)
 
 
     def _registerType(self, type, ctor):
     def _registerType(self, type, ctor):
-        if self._type2ctor.has_key(type):
+        if type in self._type2ctor:
             self.notify.debug('replacing %s ctor %s with %s' %
             self.notify.debug('replacing %s ctor %s with %s' %
                               (type, self._type2ctor[type], ctor))
                               (type, self._type2ctor[type], ctor))
         self._type2ctor[type] = ctor
         self._type2ctor[type] = ctor

+ 1 - 4
direct/src/showbase/PythonUtil.py

@@ -61,10 +61,7 @@ import bisect
 __report_indent = 3
 __report_indent = 3
 
 
 from direct.directutil import Verify
 from direct.directutil import Verify
-# Don't import libpandaexpressModules, which doesn't get built until
-# genPyCode.
-import direct.extensions_native.extension_native_helpers
-from libpandaexpress import ConfigVariableBool
+from panda3d.core import ConfigVariableBool
 
 
 ScalarTypes = (types.FloatType, types.IntType, types.LongType)
 ScalarTypes = (types.FloatType, types.IntType, types.LongType)
 
 

+ 1 - 1
direct/src/showbase/VFSImporter.py

@@ -457,7 +457,7 @@ class VFSSharedLoader:
         # Also set this special symbol, which records that this is a
         # Also set this special symbol, which records that this is a
         # shared package, and also lists the paths we have already
         # shared package, and also lists the paths we have already
         # loaded.
         # loaded.
-        mod._vfs_shared_path = vfs_shared_path + map(lambda l: l.dir_path, self.loaders)
+        mod._vfs_shared_path = vfs_shared_path + [l.dir_path for l in self.loaders]
 
 
         return mod
         return mod
 
 

+ 1 - 1
direct/src/showbase/VerboseImport.py

@@ -18,7 +18,7 @@ def newimport(*args, **kw):
     fPrint = 0
     fPrint = 0
     name = args[0]
     name = args[0]
     # Only print the name if we have not imported this before
     # Only print the name if we have not imported this before
-    if not sys.modules.has_key(name):
+    if name not in sys.modules:
         print (" "*indentLevel + "import " + args[0])
         print (" "*indentLevel + "import " + args[0])
         fPrint = 1
         fPrint = 1
     indentLevel += 1
     indentLevel += 1

+ 1 - 1
direct/src/showutil/TexMemWatcher.py

@@ -627,7 +627,7 @@ class TexMemWatcher(DirectObject):
             self.repack()
             self.repack()
 
 
         else:
         else:
-            overflowCount = sum(map(lambda tp: tp.overflowed, self.texPlacements.keys()))
+            overflowCount = sum([tp.overflowed for tp in self.texPlacements.keys()])
             if totalSize <= self.limit and overflowCount:
             if totalSize <= self.limit and overflowCount:
                 # Shouldn't be overflowing any more.  Better repack.
                 # Shouldn't be overflowing any more.  Better repack.
                 self.repack()
                 self.repack()

+ 2 - 3
direct/src/tkpanels/DirectSessionPanel.py

@@ -216,8 +216,7 @@ class DirectSessionPanel(AppShell):
         Label(drFrame, text = 'Display Region',
         Label(drFrame, text = 'Display Region',
               font=('MSSansSerif', 14, 'bold')).pack(expand = 0)
               font=('MSSansSerif', 14, 'bold')).pack(expand = 0)
 
 
-        nameList = map(lambda x: 'Display Region ' + repr(x),
-                       range(len(base.direct.drList)))
+        nameList = ['Display Region ' + repr(x) for x in range(len(base.direct.drList))]
         self.drMenu = Pmw.ComboBox(
         self.drMenu = Pmw.ComboBox(
             drFrame, labelpos = W, label_text = 'Display Region:',
             drFrame, labelpos = W, label_text = 'Display Region:',
             entry_width = 20,
             entry_width = 20,
@@ -726,7 +725,7 @@ class DirectSessionPanel(AppShell):
         else:
         else:
             # Generate a unique name for the dict
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             # Update combo box to include new item
             names.append(dictName)
             names.append(dictName)
             listbox = menu.component('scrolledlist')
             listbox = menu.component('scrolledlist')

+ 3 - 3
direct/src/tkpanels/Inspector.py

@@ -24,7 +24,7 @@ def inspect(anObject):
 
 
 def inspectorFor(anObject):
 def inspectorFor(anObject):
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
-    if _InspectorMap.has_key(typeName):
+    if typeName in _InspectorMap:
         inspectorName = _InspectorMap[typeName]
         inspectorName = _InspectorMap[typeName]
     else:
     else:
         print "Can't find an inspector for " + typeName
         print "Can't find an inspector for " + typeName
@@ -92,7 +92,7 @@ class Inspector:
             #    self._partsList.append(each)  
             #    self._partsList.append(each)  
 
 
     def initializePartNames(self):
     def initializePartNames(self):
-        self._partNames = ['up'] + map(lambda each: str(each), self._partsList)
+        self._partNames = ['up'] + [str(each) for each in self._partsList]
 
 
     def title(self):
     def title(self):
         "Subclasses may override."
         "Subclasses may override."
@@ -195,7 +195,7 @@ class DictionaryInspector(Inspector):
         if partNumber == 0:
         if partNumber == 0:
             return self.object
             return self.object
         key = self.privatePartNumber(partNumber)
         key = self.privatePartNumber(partNumber)
-        if self.object.has_key(key):
+        if key in self.object:
             return self.object[key]
             return self.object[key]
         else:
         else:
             return getattr(self.object, key)
             return getattr(self.object, key)

+ 1 - 1
direct/src/tkpanels/MopathRecorder.py

@@ -1248,7 +1248,7 @@ class MopathRecorder(AppShell, DirectObject):
         else:
         else:
             # Generate a unique name for the dict
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             # Update combo box to include new item
             names.append(dictName)
             names.append(dictName)
             listbox = menu.component('scrolledlist')
             listbox = menu.component('scrolledlist')

+ 2 - 2
direct/src/tkpanels/ParticlePanel.py

@@ -1132,7 +1132,7 @@ class ParticlePanel(AppShell):
         self.particlesLabelMenu.add_separator()
         self.particlesLabelMenu.add_separator()
         # Add in a checkbutton for each effect (to toggle on/off)
         # Add in a checkbutton for each effect (to toggle on/off)
         particles = self.particleEffect.getParticlesList()
         particles = self.particleEffect.getParticlesList()
-        names = map(lambda x: x.getName(), particles)
+        names = [x.getName() for x in particles]
         names.sort()
         names.sort()
         for name in names:
         for name in names:
             particle = self.particleEffect.getParticlesNamed(name)
             particle = self.particleEffect.getParticlesNamed(name)
@@ -1157,7 +1157,7 @@ class ParticlePanel(AppShell):
         self.forceGroupLabelMenu.add_separator()
         self.forceGroupLabelMenu.add_separator()
         # Add in a checkbutton for each effect (to toggle on/off)
         # Add in a checkbutton for each effect (to toggle on/off)
         forceGroupList = self.particleEffect.getForceGroupList()
         forceGroupList = self.particleEffect.getForceGroupList()
-        names = map(lambda x: x.getName(), forceGroupList)
+        names = [x.getName() for x in forceGroupList]
         names.sort()
         names.sort()
         for name in names:
         for name in names:
             force = self.particleEffect.getForceGroupNamed(name)
             force = self.particleEffect.getForceGroupNamed(name)

+ 1 - 1
direct/src/tkpanels/Placer.py

@@ -510,7 +510,7 @@ class Placer(AppShell):
         else:
         else:
             # Generate a unique name for the dict
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             # Update combo box to include new item
             names.append(dictName)
             names.append(dictName)
             listbox = menu.component('scrolledlist')
             listbox = menu.component('scrolledlist')

+ 1 - 2
direct/src/tkwidgets/EntryScale.py

@@ -293,8 +293,7 @@ class EntryScaleGroup(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
 
         #define the megawidget options
         #define the megawidget options
         INITOPT = Pmw.INITOPT
         INITOPT = Pmw.INITOPT

+ 1 - 2
direct/src/tkwidgets/Floater.py

@@ -218,8 +218,7 @@ class FloaterGroup(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
 
         #define the megawidget options
         #define the megawidget options
         INITOPT = Pmw.INITOPT
         INITOPT = Pmw.INITOPT

+ 1 - 1
direct/src/tkwidgets/Slider.py

@@ -262,7 +262,7 @@ class SliderWidget(Pmw.MegaWidget):
         self.initialiseoptions(SliderWidget)
         self.initialiseoptions(SliderWidget)
 
 
         # Adjust relief
         # Adjust relief
-        if not kw.has_key('relief'):
+        if 'relief' not in kw:
             if self['style'] == VALUATOR_FULL:
             if self['style'] == VALUATOR_FULL:
                 self['relief'] = FLAT
                 self['relief'] = FLAT
 
 

+ 3 - 3
direct/src/tkwidgets/Tree.py

@@ -227,7 +227,7 @@ class TreeNode:
         self.kidKeys = []
         self.kidKeys = []
         for item in sublist:
         for item in sublist:
             key = item.GetKey()
             key = item.GetKey()
-            if fUseCachedChildren and self.children.has_key(key):
+            if fUseCachedChildren and key in self.children:
                 child = self.children[key]
                 child = self.children[key]
             else:
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
                 child = TreeNode(self.canvas, self, item, self.menuList)
@@ -291,7 +291,7 @@ class TreeNode:
             sublist.sort(compareText)
             sublist.sort(compareText)
         for item in sublist:
         for item in sublist:
             key = item.GetKey()
             key = item.GetKey()
-            if fUseCachedChildren and self.children.has_key(key):
+            if fUseCachedChildren and key in self.children:
                 child = self.children[key]
                 child = self.children[key]
             else:
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
                 child = TreeNode(self.canvas, self, item, self.menuList)
@@ -452,7 +452,7 @@ class TreeNode:
             key = item.GetKey()
             key = item.GetKey()
 
 
             # Use existing child or create new TreeNode if none exists
             # Use existing child or create new TreeNode if none exists
-            if self.children.has_key(key):
+            if key in self.children:
                 child = self.children[key]
                 child = self.children[key]
             else:
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
                 child = TreeNode(self.canvas, self, item, self.menuList)

+ 3 - 5
direct/src/tkwidgets/Valuator.py

@@ -89,7 +89,7 @@ class Valuator(Pmw.MegaWidget):
         self.packValuator()
         self.packValuator()
 
 
         # Set reset value if none specified
         # Set reset value if none specified
-        if not kw.has_key('resetValue'):
+        if 'resetValue' not in kw:
             self['resetValue'] = self['value']
             self['resetValue'] = self['value']
 
 
         if self['fAdjustable']:
         if self['fAdjustable']:
@@ -351,8 +351,7 @@ class ValuatorGroup(Pmw.MegaWidget):
         DEFAULT_DIM = 1
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
 
         #define the megawidget options
         #define the megawidget options
         INITOPT = Pmw.INITOPT
         INITOPT = Pmw.INITOPT
@@ -486,8 +485,7 @@ class ValuatorGroupPanel(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
 
         #define the megawidget options
         #define the megawidget options
         INITOPT = Pmw.INITOPT
         INITOPT = Pmw.INITOPT

+ 1 - 2
direct/src/tkwidgets/VectorWidgets.py

@@ -19,8 +19,7 @@ class VectorEntry(Pmw.MegaWidget):
         DEFAULT_DIM = 3
         DEFAULT_DIM = 3
         # Default value depends on *actual* vector size, test for user input
         # Default value depends on *actual* vector size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
 
         # Process options
         # Process options
         INITOPT = Pmw.INITOPT
         INITOPT = Pmw.INITOPT

+ 12 - 12
direct/src/wxwidgets/WxPandaShell.py

@@ -126,26 +126,26 @@ class WxPandaShell(WxAppShell):
             base.startDirect(fWantTk = 0, fWantWx = 0)
             base.startDirect(fWantTk = 0, fWantWx = 0)
 
 
             base.direct.disableMouseEvents()
             base.direct.disableMouseEvents()
-            newMouseEvents = map(lambda x: "_le_per_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.mouseEvents)
+            newMouseEvents = ["_le_per_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.mouseEvents]
             base.direct.mouseEvents = newMouseEvents
             base.direct.mouseEvents = newMouseEvents
             base.direct.enableMouseEvents()
             base.direct.enableMouseEvents()
 
 
             base.direct.disableKeyEvents()
             base.direct.disableKeyEvents()
-            keyEvents = map(lambda x: "_le_per_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.keyEvents)
+            keyEvents = ["_le_per_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.keyEvents]
             base.direct.keyEvents = keyEvents
             base.direct.keyEvents = keyEvents
             base.direct.enableKeyEvents()
             base.direct.enableKeyEvents()
 
 
             base.direct.disableModifierEvents()
             base.direct.disableModifierEvents()
-            modifierEvents = map(lambda x: "_le_per_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.modifierEvents)
+            modifierEvents = ["_le_per_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.modifierEvents]
             base.direct.modifierEvents = modifierEvents
             base.direct.modifierEvents = modifierEvents
             base.direct.enableModifierEvents()
             base.direct.enableModifierEvents()