diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-04-03 18:17:54 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-04-03 18:17:54 (GMT) |
commit | a3a505076efc19ec23669370778c5fa22d030ffa (patch) | |
tree | 4d91e9339c5d09bb17147162538fe1835e47e432 | |
parent | 5f516edd77d00cae24d287285e455833d44097a7 (diff) | |
download | cpython-a3a505076efc19ec23669370778c5fa22d030ffa.zip cpython-a3a505076efc19ec23669370778c5fa22d030ffa.tar.gz cpython-a3a505076efc19ec23669370778c5fa22d030ffa.tar.bz2 |
Silence DeprecationWarnings from uses of has_key and <> in plat-mac.
-rw-r--r-- | Lib/plat-mac/EasyDialogs.py | 8 | ||||
-rw-r--r-- | Lib/plat-mac/FrameWork.py | 32 | ||||
-rw-r--r-- | Lib/plat-mac/MiniAEFrame.py | 8 | ||||
-rw-r--r-- | Lib/plat-mac/aepack.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/aetools.py | 24 | ||||
-rw-r--r-- | Lib/plat-mac/aetypes.py | 4 | ||||
-rw-r--r-- | Lib/plat-mac/buildtools.py | 2 | ||||
-rwxr-xr-x | Lib/plat-mac/bundlebuilder.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/cfmfile.py | 6 | ||||
-rw-r--r-- | Lib/plat-mac/findertools.py | 92 | ||||
-rw-r--r-- | Lib/plat-mac/gensuitemodule.py | 22 | ||||
-rw-r--r-- | Lib/plat-mac/ic.py | 4 | ||||
-rw-r--r-- | Lib/plat-mac/macerrors.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/macresource.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/pimp.py | 26 |
15 files changed, 118 insertions, 118 deletions
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index bd097bd..785fd3b 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -580,9 +580,9 @@ def _process_Nav_args(dftflags, **args): 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): @@ -593,7 +593,7 @@ def _process_Nav_args(dftflags, **args): defaultLocation = Carbon.File.FSRef(defaultLocation) args['defaultLocation'] = Carbon.AE.AECreateDesc( Carbon.AppleEvents.typeFSRef, defaultLocation.data) - 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: @@ -603,7 +603,7 @@ def _process_Nav_args(dftflags, **args): 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 diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py index 69401dd..ca8aaa6 100644 --- a/Lib/plat-mac/FrameWork.py +++ b/Lib/plat-mac/FrameWork.py @@ -219,7 +219,7 @@ class Application: 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 @@ -250,7 +250,7 @@ class Application: 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' @@ -264,7 +264,7 @@ class Application: # # Find the correct name. # - if partname.has_key(partcode): + if partcode in partname: name = "do_" + partname[partcode] else: name = "do_%d" % partcode @@ -279,7 +279,7 @@ class Application: 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: @@ -366,7 +366,7 @@ class Application: 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 @@ -381,7 +381,7 @@ class Application: 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: @@ -391,7 +391,7 @@ class Application: 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: @@ -411,7 +411,7 @@ class Application: 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) @@ -435,7 +435,7 @@ class Application: 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: @@ -515,7 +515,7 @@ class MenuBar: 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) @@ -531,7 +531,7 @@ class MenuBar: 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)" % \ @@ -605,12 +605,12 @@ class Menu: def dispatch(self, id, item, window, event): title, shortcut, callback, mtype = self.items[item-1] if callback: - if not self.bar.parent or type(callback) <> types.StringType: + if not self.bar.parent or type(callback) != types.StringType: menuhandler = callback 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) @@ -751,7 +751,7 @@ class Window: self.parent = parent def open(self, bounds=(40, 40, 400, 400), resid=None): - if resid <> None: + if resid != None: self.wid = GetNewWindow(resid, -1) else: self.wid = NewWindow(bounds, self.__class__.__name__, 1, @@ -829,7 +829,7 @@ class Window: # If we're not frontmost, select ourselves and wait for # the activate event. # - if MyFrontWindow() <> window: + if MyFrontWindow() != window: window.SelectWindow() return # We are. Handle the event. @@ -878,7 +878,7 @@ class ControlsWindow(Window): if DEBUG: print "control hit in", window, "on", control, "; pcode =", pcode def do_inContent(self, partcode, window, event): - if MyFrontWindow() <> window: + if MyFrontWindow() != window: window.SelectWindow() return (what, message, when, where, modifiers) = event diff --git a/Lib/plat-mac/MiniAEFrame.py b/Lib/plat-mac/MiniAEFrame.py index 8d758c3..d6126bb 100644 --- a/Lib/plat-mac/MiniAEFrame.py +++ b/Lib/plat-mac/MiniAEFrame.py @@ -136,11 +136,11 @@ class AEServer: _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) @@ -150,7 +150,7 @@ class AEServer: _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. diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py index 6021283..bb2a37f 100644 --- a/Lib/plat-mac/aepack.py +++ b/Lib/plat-mac/aepack.py @@ -132,7 +132,7 @@ def unpack(desc, formodulename=""): """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.... diff --git a/Lib/plat-mac/aetools.py b/Lib/plat-mac/aetools.py index bf27663..41d7a21 100644 --- a/Lib/plat-mac/aetools.py +++ b/Lib/plat-mac/aetools.py @@ -110,7 +110,7 @@ def keysubst(arguments, keydict): """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 @@ -119,11 +119,11 @@ def keysubst(arguments, keydict): 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 @@ -132,11 +132,11 @@ def decodeerror(arguments): """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 @@ -251,10 +251,10 @@ class TalkTo: _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 @@ -284,7 +284,7 @@ class TalkTo: if _arguments.get('errn', 0): raise Error, decodeerror(_arguments) # XXXX Optionally decode result - if _arguments.has_key('----'): + if '----' in _arguments: return _arguments['----'] set = _set @@ -293,10 +293,10 @@ class TalkTo: # 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 @@ -318,10 +318,10 @@ class _miniFinder(TalkTo): _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 diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index a5459c7..f333156 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -533,10 +533,10 @@ class ComponentItem(SelectableItem): 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 diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index f137411..bbb37ab 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -207,7 +207,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update, 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#'] if not copy_codefragment: skiptypes.append('cfrg') -## skipowner = (ownertype <> None) +## skipowner = (ownertype != None) # Copy the resources from the template diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py index d13403c..ce7ce45 100755 --- a/Lib/plat-mac/bundlebuilder.py +++ b/Lib/plat-mac/bundlebuilder.py @@ -489,7 +489,7 @@ class AppBuilder(BundleBuilder): 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" : [ "****", diff --git a/Lib/plat-mac/cfmfile.py b/Lib/plat-mac/cfmfile.py index ddbd468..26238e9 100644 --- a/Lib/plat-mac/cfmfile.py +++ b/Lib/plat-mac/cfmfile.py @@ -77,7 +77,7 @@ class CfrgResource: Res.CloseResFile(resref) Res.UseResFile(currentresref) self.parse(data) - if self.version <> 1: + if self.version != 1: raise error, "unknown 'cfrg' resource format" def parse(self, data): @@ -147,7 +147,7 @@ class FragmentDescriptor: return data def getfragment(self): - if self.where <> 1: + if self.where != 1: raise error, "can't read fragment, unsupported location" f = open(self.path, "rb") f.seek(self.offset) @@ -159,7 +159,7 @@ class FragmentDescriptor: return frag def copydata(self, outfile): - if self.where <> 1: + if self.where != 1: raise error, "can't read fragment, unsupported location" infile = open(self.path, "rb") if self.length == 0: diff --git a/Lib/plat-mac/findertools.py b/Lib/plat-mac/findertools.py index 56e7980..1363562 100644 --- a/Lib/plat-mac/findertools.py +++ b/Lib/plat-mac/findertools.py @@ -143,9 +143,9 @@ def _setcomment(object_alias, comment): 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): @@ -156,9 +156,9 @@ def _getcomment(object_alias): 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['----'] @@ -178,10 +178,10 @@ def processes(): ## 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'): @@ -197,9 +197,9 @@ def processes(): 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 @@ -252,9 +252,9 @@ def _processproperty(processname, property): 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['----'] @@ -273,7 +273,7 @@ def openwindow(object): 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): @@ -288,7 +288,7 @@ def closewindow(object): 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): @@ -310,7 +310,7 @@ def _setlocation(object_alias, (x, y)): 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) @@ -323,9 +323,9 @@ def _getlocation(object_alias): 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 @@ -348,9 +348,9 @@ def _getlabel(object_alias): 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): @@ -367,7 +367,7 @@ def _setlabel(object_alias, index): 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 @@ -407,9 +407,9 @@ def _setwindowview(folder_alias, view=0): 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): @@ -424,10 +424,10 @@ def _getwindowview(folder_alias): 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): @@ -459,7 +459,7 @@ def _setwindowsize(folder_alias, (w, h)): 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) @@ -476,9 +476,9 @@ def _getwindowsize(folder_alias): 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): @@ -507,9 +507,9 @@ def _setwindowposition(folder_alias, (x, y)): 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): @@ -525,9 +525,9 @@ def _getwindowposition(folder_alias): 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): @@ -552,9 +552,9 @@ def _geticon(object_alias): 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): @@ -569,9 +569,9 @@ def _seticon(object_alias, icondata): 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 @@ -594,9 +594,9 @@ def mountvolume(volume, server=None, username=None, password=None): 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): @@ -610,9 +610,9 @@ def putaway(object): 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['----'] @@ -631,9 +631,9 @@ def volumelevel(level): 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(): @@ -644,9 +644,9 @@ def OSversion(): 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(): @@ -661,9 +661,9 @@ def filesharing(): 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: @@ -673,9 +673,9 @@ def filesharing(): 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 @@ -693,7 +693,7 @@ def emptytrash(): 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) diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py index 28ebea6..2bae08a 100644 --- a/Lib/plat-mac/gensuitemodule.py +++ b/Lib/plat-mac/gensuitemodule.py @@ -172,7 +172,7 @@ def processfile_fromresource(fullname, output=None, basepkgname=None, aete = decode(data, verbose) aetelist.append((aete, res.GetResInfo())) finally: - if rf <> cur: + if rf != cur: CloseResFile(rf) UseResFile(cur) # switch back (needed for dialogs in Python) @@ -335,7 +335,7 @@ def getpstr(f, *args): def getalign(f): if f.tell() & 1: c = f.read(1) - ##if c <> '\0': + ##if c != '\0': ## print align:', repr(c) def getlist(f, description, getitem): @@ -592,7 +592,7 @@ class SuiteCompiler: 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] @@ -659,12 +659,12 @@ class SuiteCompiler: 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()] @@ -782,7 +782,7 @@ class SuiteCompiler: if is_enum(a[2]): kname = a[1] ename = a[2][0] - if ename <> '****': + if ename != '****': fp.write(" aetools.enumsubst(_arguments, %r, _Enum_%s)\n" % (kname, identify(ename))) self.enumsneeded[ename] = 1 @@ -801,7 +801,7 @@ class SuiteCompiler: # # 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") @@ -813,7 +813,7 @@ class SuiteCompiler: for a in arguments: if is_enum(a[2]): ename = a[2][0] - if ename <> '****': + if ename != '****': self.enumsneeded[ename] = 1 # @@ -845,17 +845,17 @@ class CodeNameMapper: 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): diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py index 8337f2d..321eba8 100644 --- a/Lib/plat-mac/ic.py +++ b/Lib/plat-mac/ic.py @@ -141,7 +141,7 @@ def _decode(data, key): 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 @@ -154,7 +154,7 @@ def _code(data, key): 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 diff --git a/Lib/plat-mac/macerrors.py b/Lib/plat-mac/macerrors.py index de1c1e2..58d79d6 100644 --- a/Lib/plat-mac/macerrors.py +++ b/Lib/plat-mac/macerrors.py @@ -1579,7 +1579,7 @@ smFHBlkDispErr = -311 #Error occurred during _sDisposePtr (Dispose of FHea smFHBlockRdErr = -310 #Error occurred during _sGetFHeader. smBLFieldBad = -309 #ByteLanes field was bad. smUnExBusErr = -308 #Unexpected BusError -smResrvErr = -307 #Fatal reserved error. Resreved field <> 0. +smResrvErr = -307 #Fatal reserved error. Reserved field != 0. smNosInfoArray = -306 #No sInfoArray. Memory Mgr error. smDisabledSlot = -305 #This slot is disabled (-305 use to be smLWTstBad) smNoDir = -304 #Directory offset is Nil diff --git a/Lib/plat-mac/macresource.py b/Lib/plat-mac/macresource.py index d693c87..3b48d4b 100644 --- a/Lib/plat-mac/macresource.py +++ b/Lib/plat-mac/macresource.py @@ -51,7 +51,7 @@ def need(restype, resid, filename=None, modname=None): 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__)] diff --git a/Lib/plat-mac/pimp.py b/Lib/plat-mac/pimp.py index 5fc16f0..9a3e82e 100644 --- a/Lib/plat-mac/pimp.py +++ b/Lib/plat-mac/pimp.py @@ -152,7 +152,7 @@ class PimpUrllibDownloader(PimpDownloader): 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 @@ -420,7 +420,7 @@ class PimpDatabase: 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': @@ -552,9 +552,9 @@ class PimpPackage: 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 @@ -647,9 +647,9 @@ class PimpPackage: 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: @@ -800,10 +800,10 @@ class PimpPackage_binary(PimpPackage): 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']) @@ -836,7 +836,7 @@ class PimpPackage_binary(PimpPackage): 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']) @@ -861,7 +861,7 @@ class PimpPackage_source(PimpPackage): 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']) @@ -898,7 +898,7 @@ class PimpPackage_source(PimpPackage): 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']) @@ -916,10 +916,10 @@ class PimpPackage_installer(PimpPackage): 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']) |