[Python-3000-checkins] r51418 - in python/branches/p3yk/Lib: distutils/dir_util.py distutils/msvccompiler.py encodings/__init__.py msilib/__init__.py plat-mac/EasyDialogs.py plat-mac/FrameWork.py plat-mac/MiniAEFrame.py plat-mac/aepack.py plat-mac/aetools.py plat-mac/aetypes.py plat-mac/bundlebuilder.py plat-mac/findertools.py plat-mac/gensuitemodule.py plat-mac/ic.py plat-mac/macresource.py plat-mac/pimp.py

neal.norwitz python-3000-checkins at python.org
Sun Aug 20 18:25:11 CEST 2006


Author: neal.norwitz
Date: Sun Aug 20 18:25:10 2006
New Revision: 51418

Modified:
   python/branches/p3yk/Lib/distutils/dir_util.py
   python/branches/p3yk/Lib/distutils/msvccompiler.py
   python/branches/p3yk/Lib/encodings/__init__.py
   python/branches/p3yk/Lib/msilib/__init__.py
   python/branches/p3yk/Lib/plat-mac/EasyDialogs.py
   python/branches/p3yk/Lib/plat-mac/FrameWork.py
   python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py
   python/branches/p3yk/Lib/plat-mac/aepack.py
   python/branches/p3yk/Lib/plat-mac/aetools.py
   python/branches/p3yk/Lib/plat-mac/aetypes.py
   python/branches/p3yk/Lib/plat-mac/bundlebuilder.py
   python/branches/p3yk/Lib/plat-mac/findertools.py
   python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
   python/branches/p3yk/Lib/plat-mac/ic.py
   python/branches/p3yk/Lib/plat-mac/macresource.py
   python/branches/p3yk/Lib/plat-mac/pimp.py
Log:
Get rid of a bunch more has_key() uses.  We *really* need a tool for this.
test_aepack now passes.  IDLE still needs to be converted (among others).


Modified: python/branches/p3yk/Lib/distutils/dir_util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/dir_util.py	(original)
+++ python/branches/p3yk/Lib/distutils/dir_util.py	Sun Aug 20 18:25:10 2006
@@ -207,7 +207,7 @@
             cmd[0](cmd[1])
             # remove dir from cache if it's already there
             abspath = os.path.abspath(cmd[1])
-            if _path_created.has_key(abspath):
+            if abspath in _path_created:
                 del _path_created[abspath]
         except (IOError, OSError), exc:
             log.warn(grok_environment_error(

Modified: python/branches/p3yk/Lib/distutils/msvccompiler.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/msvccompiler.py	(original)
+++ python/branches/p3yk/Lib/distutils/msvccompiler.py	Sun Aug 20 18:25:10 2006
@@ -239,7 +239,7 @@
 
     def initialize(self):
         self.__paths = []
-        if os.environ.has_key("DISTUTILS_USE_SDK") and os.environ.has_key("MSSdk") and self.find_exe("cl.exe"):
+        if "DISTUTILS_USE_SDK" in os.environ and "MSSdk" in os.environ and self.find_exe("cl.exe"):
             # Assume that the SDK set up everything alright; don't try to be
             # smarter
             self.cc = "cl.exe"

Modified: python/branches/p3yk/Lib/encodings/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/encodings/__init__.py	(original)
+++ python/branches/p3yk/Lib/encodings/__init__.py	Sun Aug 20 18:25:10 2006
@@ -144,7 +144,7 @@
         pass
     else:
         for alias in codecaliases:
-            if not _aliases.has_key(alias):
+            if alias not in _aliases:
                 _aliases[alias] = modname
 
     # Return the registry entry

Modified: python/branches/p3yk/Lib/msilib/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/msilib/__init__.py	(original)
+++ python/branches/p3yk/Lib/msilib/__init__.py	Sun Aug 20 18:25:10 2006
@@ -326,7 +326,7 @@
             file = os.path.basename(file)
         absolute = os.path.join(self.absolute, src)
         assert not re.search(r'[\?|><:/*]"', file) # restrictions on long names
-        if self.keyfiles.has_key(file):
+        if file in self.keyfiles:
             logical = self.keyfiles[file]
         else:
             logical = None

Modified: python/branches/p3yk/Lib/plat-mac/EasyDialogs.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/EasyDialogs.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/EasyDialogs.py	Sun Aug 20 18:25:10 2006
@@ -577,9 +577,9 @@
         if args[k] is None:
             del args[k]
     # Set some defaults, and modify some arguments
-    if not args.has_key('dialogOptionFlags'):
+    if 'dialogOptionFlags' not in args:
         args['dialogOptionFlags'] = dftflags
-    if args.has_key('defaultLocation') and \
+    if 'defaultLocation' in args and \
             not isinstance(args['defaultLocation'], Carbon.AE.AEDesc):
         defaultLocation = args['defaultLocation']
         if isinstance(defaultLocation, (Carbon.File.FSSpec, Carbon.File.FSRef)):
@@ -587,7 +587,7 @@
         else:
             defaultLocation = Carbon.File.FSRef(defaultLocation)
             args['defaultLocation'] = aepack.pack(defaultLocation)
-    if args.has_key('typeList') and not isinstance(args['typeList'], Carbon.Res.ResourceType):
+    if 'typeList' in args and not isinstance(args['typeList'], Carbon.Res.ResourceType):
         typeList = args['typeList'][:]
         # Workaround for OSX typeless files:
         if 'TEXT' in typeList and not '\0\0\0\0' in typeList:
@@ -597,7 +597,7 @@
             data = data+type
         args['typeList'] = Carbon.Res.Handle(data)
     tpwanted = str
-    if args.has_key('wanted'):
+    if 'wanted' in args:
         tpwanted = args['wanted']
         del args['wanted']
     return args, tpwanted

Modified: python/branches/p3yk/Lib/plat-mac/FrameWork.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/FrameWork.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/FrameWork.py	Sun Aug 20 18:25:10 2006
@@ -216,7 +216,7 @@
             if self.do_dialogevent(event):
                 return
         (what, message, when, where, modifiers) = event
-        if eventname.has_key(what):
+        if what in eventname:
             name = "do_" + eventname[what]
         else:
             name = "do_%d" % what
@@ -247,7 +247,7 @@
         gotone, dlg, item = DialogSelect(event)
         if gotone:
             window = dlg.GetDialogWindow()
-            if self._windows.has_key(window):
+            if window in self._windows:
                 self._windows[window].do_itemhit(item, event)
             else:
                 print 'Dialog event for unknown dialog'
@@ -261,7 +261,7 @@
         #
         # Find the correct name.
         #
-        if partname.has_key(partcode):
+        if partcode in partname:
             name = "do_" + partname[partcode]
         else:
             name = "do_%d" % partcode
@@ -276,7 +276,7 @@
                 if hasattr(MacOS, 'HandleEvent'):
                     MacOS.HandleEvent(event)
                 return
-        elif self._windows.has_key(wid):
+        elif wid in self._windows:
             # It is a window. Hand off to correct window.
             window = self._windows[wid]
             try:
@@ -363,7 +363,7 @@
         else:
             # See whether the front window wants it
             w = MyFrontWindow()
-            if w and self._windows.has_key(w):
+            if w and w in self._windows:
                 window = self._windows[w]
                 try:
                     do_char = window.do_char
@@ -378,7 +378,7 @@
     def do_updateEvt(self, event):
         (what, message, when, where, modifiers) = event
         wid = WhichWindow(message)
-        if wid and self._windows.has_key(wid):
+        if wid and wid in self._windows:
             window = self._windows[wid]
             window.do_rawupdate(wid, event)
         else:
@@ -388,7 +388,7 @@
     def do_activateEvt(self, event):
         (what, message, when, where, modifiers) = event
         wid = WhichWindow(message)
-        if wid and self._windows.has_key(wid):
+        if wid and wid in self._windows:
             window = self._windows[wid]
             window.do_activate(modifiers & 1, event)
         else:
@@ -408,7 +408,7 @@
     def do_suspendresume(self, event):
         (what, message, when, where, modifiers) = event
         wid = MyFrontWindow()
-        if wid and self._windows.has_key(wid):
+        if wid and wid in self._windows:
             window = self._windows[wid]
             window.do_activate(message & 1, event)
 
@@ -432,7 +432,7 @@
     def printevent(self, event):
         (what, message, when, where, modifiers) = event
         nicewhat = repr(what)
-        if eventname.has_key(what):
+        if what in eventname:
             nicewhat = eventname[what]
         print nicewhat,
         if what == kHighLevelEvent:
@@ -512,7 +512,7 @@
                 label, shortcut, callback, kind = menu.items[i]
                 if type(callback) == types.StringType:
                     wid = MyFrontWindow()
-                    if wid and self.parent._windows.has_key(wid):
+                    if wid and wid in self.parent._windows:
                         window = self.parent._windows[wid]
                         if hasattr(window, "domenu_" + callback):
                             menu.menu.EnableMenuItem(i + 1)
@@ -528,7 +528,7 @@
                     pass
 
     def dispatch(self, id, item, window, event):
-        if self.menus.has_key(id):
+        if id in self.menus:
             self.menus[id].dispatch(id, item, window, event)
         else:
             if DEBUG: print "MenuBar.dispatch(%d, %d, %s, %s)" % \
@@ -607,7 +607,7 @@
             else:
                 # callback is string
                 wid = MyFrontWindow()
-                if wid and self.bar.parent._windows.has_key(wid):
+                if wid and wid in self.bar.parent._windows:
                     window = self.bar.parent._windows[wid]
                     if hasattr(window, "domenu_" + callback):
                         menuhandler = getattr(window, "domenu_" + callback)

Modified: python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/MiniAEFrame.py	Sun Aug 20 18:25:10 2006
@@ -134,11 +134,11 @@
         _class = _attributes['evcl'].type
         _type = _attributes['evid'].type
 
-        if self.ae_handlers.has_key((_class, _type)):
+        if (_class, _type) in self.ae_handlers:
             _function = self.ae_handlers[(_class, _type)]
-        elif self.ae_handlers.has_key((_class, '****')):
+        elif (_class, '****') in self.ae_handlers:
             _function = self.ae_handlers[(_class, '****')]
-        elif self.ae_handlers.has_key(('****', '****')):
+        elif ('****', '****') in self.ae_handlers:
             _function = self.ae_handlers[('****', '****')]
         else:
             raise 'Cannot happen: AE callback without handler', (_class, _type)
@@ -148,7 +148,7 @@
         _parameters['_attributes'] = _attributes
         _parameters['_class'] = _class
         _parameters['_type'] = _type
-        if _parameters.has_key('----'):
+        if '----' in _parameters:
             _object = _parameters['----']
             del _parameters['----']
             # The try/except that used to be here can mask programmer errors.

Modified: python/branches/p3yk/Lib/plat-mac/aepack.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/aepack.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/aepack.py	Sun Aug 20 18:25:10 2006
@@ -129,7 +129,7 @@
     """Unpack an AE descriptor to a python object"""
     t = desc.type
 
-    if unpacker_coercions.has_key(t):
+    if t in unpacker_coercions:
         desc = desc.AECoerceDesc(unpacker_coercions[t])
         t = desc.type # This is a guess by Jack....
 

Modified: python/branches/p3yk/Lib/plat-mac/aetools.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/aetools.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/aetools.py	Sun Aug 20 18:25:10 2006
@@ -107,7 +107,7 @@
     """Replace long name keys by their 4-char counterparts, and check"""
     ok = keydict.values()
     for k in arguments.keys():
-        if keydict.has_key(k):
+        if k in keydict:
             v = arguments[k]
             del arguments[k]
             arguments[keydict[k]] = v
@@ -116,11 +116,11 @@
 
 def enumsubst(arguments, key, edict):
     """Substitute a single enum keyword argument, if it occurs"""
-    if not arguments.has_key(key) or edict is None:
+    if key not in arguments or edict is None:
         return
     v = arguments[key]
     ok = edict.values()
-    if edict.has_key(v):
+    if v in edict:
         arguments[key] = Enum(edict[v])
     elif not v in ok:
         raise TypeError, 'Unknown enumerator: %s'%v
@@ -129,11 +129,11 @@
     """Create the 'best' argument for a raise MacOS.Error"""
     errn = arguments['errn']
     err_a1 = errn
-    if arguments.has_key('errs'):
+    if 'errs' in arguments:
         err_a2 = arguments['errs']
     else:
         err_a2 = MacOS.GetErrorString(errn)
-    if arguments.has_key('erob'):
+    if 'erob' in arguments:
         err_a3 = arguments['erob']
     else:
         err_a3 = None
@@ -248,10 +248,10 @@
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
-        if _arguments.has_key('errn'):
+        if 'errn' in _arguments:
             raise Error, decodeerror(_arguments)
 
-        if _arguments.has_key('----'):
+        if '----' in _arguments:
             return _arguments['----']
             if asfile:
                 item.__class__ = asfile
@@ -281,7 +281,7 @@
         if _arguments.get('errn', 0):
             raise Error, decodeerror(_arguments)
         # XXXX Optionally decode result
-        if _arguments.has_key('----'):
+        if '----' in _arguments:
             return _arguments['----']
 
     set = _set
@@ -290,10 +290,10 @@
     # like the "application" class in OSA.
 
     def __getattr__(self, name):
-        if self._elemdict.has_key(name):
+        if name in self._elemdict:
             cls = self._elemdict[name]
             return DelayedComponentItem(cls, None)
-        if self._propdict.has_key(name):
+        if name in self._propdict:
             cls = self._propdict[name]
             return cls()
         raise AttributeError, name
@@ -315,10 +315,10 @@
 
         _reply, _arguments, _attributes = self.send(_code, _subcode,
                 _arguments, _attributes)
-        if _arguments.has_key('errn'):
+        if 'errn' in _arguments:
             raise Error, decodeerror(_arguments)
         # XXXX Optionally decode result
-        if _arguments.has_key('----'):
+        if '----' in _arguments:
             return _arguments['----']
 #pass
 

Modified: python/branches/p3yk/Lib/plat-mac/aetypes.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/aetypes.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/aetypes.py	Sun Aug 20 18:25:10 2006
@@ -530,10 +530,10 @@
         return s
 
     def __getattr__(self, name):
-        if self._elemdict.has_key(name):
+        if name in self._elemdict:
             cls = self._elemdict[name]
             return DelayedComponentItem(cls, self)
-        if self._propdict.has_key(name):
+        if name in self._propdict:
             cls = self._propdict[name]
             return cls(self)
         raise AttributeError, name

Modified: python/branches/p3yk/Lib/plat-mac/bundlebuilder.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/bundlebuilder.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/bundlebuilder.py	Sun Aug 20 18:25:10 2006
@@ -481,7 +481,7 @@
                 if self.standalone or self.semi_standalone:
                     self.includeModules.append("argvemulator")
                     self.includeModules.append("os")
-                if not self.plist.has_key("CFBundleDocumentTypes"):
+                if "CFBundleDocumentTypes" not in self.plist:
                     self.plist["CFBundleDocumentTypes"] = [
                         { "CFBundleTypeOSTypes" : [
                             "****",

Modified: python/branches/p3yk/Lib/plat-mac/findertools.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/findertools.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/findertools.py	Sun Aug 20 18:25:10 2006
@@ -139,9 +139,9 @@
     args['----'] = aeobj_01
     args["data"] = comment
     _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def _getcomment(object_alias):
@@ -152,9 +152,9 @@
     aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00)
     args['----'] = aeobj_01
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 
@@ -174,10 +174,10 @@
     ## get the processnames or else the processnumbers
     args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
     _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
     p = []
-    if args.has_key('----'):
+    if '----' in args:
         p =  args['----']
         for proc in p:
             if hasattr(proc, 'seld'):
@@ -193,9 +193,9 @@
     aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
     args['----'] =  aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=aeobj_0)
     _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(_arg)
-    if args.has_key('----'):
+    if '----' in args:
         p =  args['----']
         creators = p[:]
     ## concatenate in one dict
@@ -248,9 +248,9 @@
     aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type(property), fr=aeobj_00)
     args['----'] = aeobj_01
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 
@@ -269,7 +269,7 @@
     aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
     args['----'] = aeobj_0
     _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
 
 def closewindow(object):
@@ -284,7 +284,7 @@
     aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None)
     args['----'] = aeobj_0
     _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
 
 def location(object, pos=None):
@@ -306,7 +306,7 @@
     args['----'] = aeobj_01
     args["data"] = [x, y]
     _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
     return (x,y)
 
@@ -319,9 +319,9 @@
     aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00)
     args['----'] = aeobj_01
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         pos = args['----']
         return pos.h, pos.v
 
@@ -344,9 +344,9 @@
     aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('labi'), fr=aeobj_00)
     args['----'] = aeobj_01
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def _setlabel(object_alias, index):
@@ -363,7 +363,7 @@
     args['----'] = aeobj_1
     args["data"] = index
     _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
     return index
 
@@ -403,9 +403,9 @@
     args['----'] = aeobj_2
     args['data'] = aeobj_3
     _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def _getwindowview(folder_alias):
@@ -420,10 +420,10 @@
     aeobj_02 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('pvew'), fr=aeobj_01)
     args['----'] = aeobj_02
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
     views = {'iimg':0, 'pnam':1, 'lgbu':2}
-    if args.has_key('----'):
+    if '----' in args:
         return views[args['----'].enum]
 
 def windowsize(folder, size=None):
@@ -455,7 +455,7 @@
     args['----'] = aeobj_2
     args["data"] = aevar00
     _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
     return (w, h)
 
@@ -472,9 +472,9 @@
             form="prop", seld=aetypes.Type('posn'), fr=aeobj_1)
     args['----'] = aeobj_2
     _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def windowposition(folder, pos=None):
@@ -503,9 +503,9 @@
     args['----'] = aeobj_2
     args["data"] = [x, y]
     _reply, args, attrs = finder.send('core', 'setd', args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def _getwindowposition(folder_alias):
@@ -521,9 +521,9 @@
             form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1)
     args['----'] = aeobj_2
     _reply, args, attrs = finder.send('core', 'getd', args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def icon(object, icondata=None):
@@ -548,9 +548,9 @@
             form="prop", seld=aetypes.Type('iimg'), fr=aeobj_00)
     args['----'] = aeobj_01
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def _seticon(object_alias, icondata):
@@ -565,9 +565,9 @@
     args['----'] = aeobj_01
     args["data"] = icondata
     _reply, args, attrs = finder.send("core", "setd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----'].data
 
 
@@ -590,9 +590,9 @@
         args["SRVR"] = server
     args['----'] = volume
     _reply, args, attrs = finder.send("aevt", "mvol", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def unmountvolume(volume):
@@ -606,9 +606,9 @@
     attrs = {}
     args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None)
     _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 
@@ -627,9 +627,9 @@
         level = 7
     args['----'] = level
     _reply, args, attrs = finder.send("aevt", "stvl", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def OSversion():
@@ -640,9 +640,9 @@
     aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ver2'), fr=None)
     args['----'] = aeobj_00
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         return args['----']
 
 def filesharing():
@@ -657,9 +657,9 @@
     attrs = {}
     args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None)
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         if args['----'] == 0:
             status = -1
         else:
@@ -669,9 +669,9 @@
     attrs = {}
     args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None)
     _reply, args, attrs = finder.send("core", "getd", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise Error, aetools.decodeerror(args)
-    if args.has_key('----'):
+    if '----' in args:
         if args['----'] == 1:
             status = 0
     return status
@@ -689,7 +689,7 @@
     attrs = {}
     args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None)
     _reply, args, attrs = finder.send("fndr", "empt", args, attrs)
-    if args.has_key('errn'):
+    if 'errn' in args:
         raise aetools.Error, aetools.decodeerror(args)
 
 

Modified: python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	Sun Aug 20 18:25:10 2006
@@ -589,7 +589,7 @@
 
         self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0]
 
-        if self.basepackage and self.basepackage._code_to_module.has_key(code):
+        if self.basepackage and code in self.basepackage._code_to_module:
             # We are an extension of a baseclass (usually an application extending
             # Standard_Suite or so). Import everything from our base module
             basemodule = self.basepackage._code_to_module[code]
@@ -656,12 +656,12 @@
         fp.write('import aetools\n')
         fp.write('import MacOS\n\n')
         fp.write("_code = %r\n\n"% (code,))
-        if self.basepackage and self.basepackage._code_to_module.has_key(code):
+        if self.basepackage and code in self.basepackage._code_to_module:
             # We are an extension of a baseclass (usually an application extending
             # Standard_Suite or so). Import everything from our base module
             fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0])
             basemodule = self.basepackage._code_to_module[code]
-        elif self.basepackage and self.basepackage._code_to_module.has_key(code.lower()):
+        elif self.basepackage and code.lower() in self.basepackage._code_to_module:
             # This is needed by CodeWarrior and some others.
             fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0])
             basemodule = self.basepackage._code_to_module[code.lower()]
@@ -798,7 +798,7 @@
         #
         # Decode result
         #
-        fp.write("        if _arguments.has_key('----'):\n")
+        fp.write("        if '----' in _arguments:\n")
         if is_enum(returns):
             fp.write("            # XXXX Should do enum remapping here...\n")
         fp.write("            return _arguments['----']\n")
@@ -842,17 +842,17 @@
 
     def addnamecode(self, type, name, code):
         self.name2code[type][name] = code
-        if not self.code2name[type].has_key(code):
+        if code not in self.code2name[type]:
             self.code2name[type][code] = name
 
     def hasname(self, name):
         for dict in self.name2code.values():
-            if dict.has_key(name):
+            if name in dict:
                 return True
         return False
 
     def hascode(self, type, code):
-        return self.code2name[type].has_key(code)
+        return code in self.code2name[type]
 
     def findcodename(self, type, code):
         if not self.hascode(type, code):

Modified: python/branches/p3yk/Lib/plat-mac/ic.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/ic.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/ic.py	Sun Aug 20 18:25:10 2006
@@ -138,7 +138,7 @@
         key2 = key[:string.index(key, '\245')+1]
     else:
         key2 = key
-    if _decoder_table.has_key(key2):
+    if key2 in _decoder_table:
         decoder = _decoder_table[key2][0]
     else:
         decoder = _decode_default
@@ -151,7 +151,7 @@
         key2 = key[:string.index(key, '\245')+1]
     else:
         key2 = key
-    if _decoder_table.has_key(key2):
+    if key2 in _decoder_table:
         coder = _decoder_table[key2][1]
     else:
         coder = _code_default
@@ -176,9 +176,6 @@
         self.ic.ICEnd()
         return rv
 
-    def has_key(self, key):
-        return self.__contains__(key)
-
     def __contains__(self, key):
         try:
             dummy = self.ic.ICFindPrefHandle(key, self.h)

Modified: python/branches/p3yk/Lib/plat-mac/macresource.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/macresource.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/macresource.py	Sun Aug 20 18:25:10 2006
@@ -48,7 +48,7 @@
     if modname == '__main__':
         # If we're main we look in the current directory
         searchdirs = [os.curdir]
-    if sys.modules.has_key(modname):
+    if modname in sys.modules:
         mod = sys.modules[modname]
         if hasattr(mod, '__file__'):
             searchdirs = [os.path.dirname(mod.__file__)]

Modified: python/branches/p3yk/Lib/plat-mac/pimp.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/pimp.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/pimp.py	Sun Aug 20 18:25:10 2006
@@ -147,7 +147,7 @@
         self.update("Downloading %s: opening connection" % url)
         keepgoing = True
         download = urllib2.urlopen(url)
-        if download.headers.has_key("content-length"):
+        if "content-length" in download.headers:
             length = long(download.headers['content-length'])
         else:
             length = -1
@@ -415,7 +415,7 @@
 
         for p in packages:
             p = dict(p)
-            if p.has_key('Download-URL'):
+            if 'Download-URL' in p:
                 p['Download-URL'] = urllib.basejoin(url, p['Download-URL'])
             flavor = p.get('Flavor')
             if flavor == 'source':
@@ -547,9 +547,9 @@
         installed through pimp, return the name in (parentheses)."""
 
         rv = self._dict['Name']
-        if self._dict.has_key('Version'):
+        if 'Version' in self._dict:
             rv = rv + '-%s' % self._dict['Version']
-        if self._dict.has_key('Flavor'):
+        if 'Flavor' in self._dict:
             rv = rv + '-%s' % self._dict['Flavor']
         if self._dict.get('Flavor') == 'hidden':
             # Pseudo-package, show in parentheses
@@ -642,9 +642,9 @@
                 descr = str(item)
             else:
                 name = item['Name']
-                if item.has_key('Version'):
+                if 'Version' in item:
                     name = name + '-' + item['Version']
-                if item.has_key('Flavor'):
+                if 'Flavor' in item:
                     name = name + '-' + item['Flavor']
                 pkg = self._db.find(name)
                 if not pkg:
@@ -795,10 +795,10 @@
         If output is given it should be a file-like object and it
         will receive a log of what happened."""
 
-        if self._dict.has_key('Install-command'):
+        if 'Install-command' in self._dict:
             return "%s: Binary package cannot have Install-command" % self.fullname()
 
-        if self._dict.has_key('Pre-install-command'):
+        if 'Pre-install-command' in self._dict:
             if _cmd(output, '/tmp', self._dict['Pre-install-command']):
                 return "pre-install %s: running \"%s\" failed" % \
                     (self.fullname(), self._dict['Pre-install-command'])
@@ -831,7 +831,7 @@
 
         self.afterInstall()
 
-        if self._dict.has_key('Post-install-command'):
+        if 'Post-install-command' in self._dict:
             if _cmd(output, '/tmp', self._dict['Post-install-command']):
                 return "%s: post-install: running \"%s\" failed" % \
                     (self.fullname(), self._dict['Post-install-command'])
@@ -856,7 +856,7 @@
         If output is given it should be a file-like object and it
         will receive a log of what happened."""
 
-        if self._dict.has_key('Pre-install-command'):
+        if 'Pre-install-command' in self._dict:
             if _cmd(output, self._buildDirname, self._dict['Pre-install-command']):
                 return "pre-install %s: running \"%s\" failed" % \
                     (self.fullname(), self._dict['Pre-install-command'])
@@ -893,7 +893,7 @@
 
         self.afterInstall()
 
-        if self._dict.has_key('Post-install-command'):
+        if 'Post-install-command' in self._dict:
             if _cmd(output, self._buildDirname, self._dict['Post-install-command']):
                 return "post-install %s: running \"%s\" failed" % \
                     (self.fullname(), self._dict['Post-install-command'])
@@ -911,10 +911,10 @@
         If output is given it should be a file-like object and it
         will receive a log of what happened."""
 
-        if self._dict.has_key('Post-install-command'):
+        if 'Post-install-command' in self._dict:
             return "%s: Installer package cannot have Post-install-command" % self.fullname()
 
-        if self._dict.has_key('Pre-install-command'):
+        if 'Pre-install-command' in self._dict:
             if _cmd(output, '/tmp', self._dict['Pre-install-command']):
                 return "pre-install %s: running \"%s\" failed" % \
                     (self.fullname(), self._dict['Pre-install-command'])


More information about the Python-3000-checkins mailing list