Changeset 388 for python/vendor/current/Lib/plat-mac
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- Location:
- python/vendor/current/Lib/plat-mac
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/plat-mac/Carbon/__init__.py
r2 r388 5 5 6 6 from warnings import warnpy3k 7 warnpy3k("In 3.x, Carbonis removed.", stacklevel=2)7 warnpy3k("In 3.x, the Carbon package is removed.", stacklevel=2) -
python/vendor/current/Lib/plat-mac/EasyDialogs.py
r2 r388 244 244 245 245 246 247 screenbounds = Qd.GetQDGlobalsScreenBits().bounds 246 # The deprecated Carbon QuickDraw APIs are no longer available as of 247 # OS X 10.8. Raise an ImportError here in that case so that callers 248 # of EasyDialogs, like BuildApplet, will do the right thing. 249 250 try: 251 screenbounds = Qd.GetQDGlobalsScreenBits().bounds 252 except AttributeError: 253 raise ImportError("QuickDraw APIs not available") 254 248 255 screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ 249 256 screenbounds[2]-4, screenbounds[3]-4 … … 581 588 del args[k] 582 589 # Set some defaults, and modify some arguments 583 if not args.has_key('dialogOptionFlags'):590 if 'dialogOptionFlags' not in args: 584 591 args['dialogOptionFlags'] = dftflags 585 if args.has_key('defaultLocation')and \592 if 'defaultLocation' in args and \ 586 593 not isinstance(args['defaultLocation'], Carbon.AE.AEDesc): 587 594 defaultLocation = args['defaultLocation'] … … 594 601 args['defaultLocation'] = Carbon.AE.AECreateDesc( 595 602 Carbon.AppleEvents.typeFSRef, defaultLocation.data) 596 if args.has_key('typeList')and not isinstance(args['typeList'], Carbon.Res.ResourceType):603 if 'typeList' in args and not isinstance(args['typeList'], Carbon.Res.ResourceType): 597 604 typeList = args['typeList'][:] 598 605 # Workaround for OSX typeless files: … … 604 611 args['typeList'] = Carbon.Res.Handle(data) 605 612 tpwanted = str 606 if args.has_key('wanted'):613 if 'wanted' in args: 607 614 tpwanted = args['wanted'] 608 615 del args['wanted'] … … 722 729 return tpwanted(rr.selection[0]) 723 730 if issubclass(tpwanted, (str, unicode)): 724 if sys.platform == 'mac': 725 fullpath = rr.selection[0].as_pathname() 726 else: 727 # This is gross, and probably incorrect too 728 vrefnum, dirid, name = rr.selection[0].as_tuple() 729 pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) 730 pardir_fsr = Carbon.File.FSRef(pardir_fss) 731 pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 732 name_utf8 = unicode(name, 'macroman').encode('utf8') 733 fullpath = os.path.join(pardir_path, name_utf8) 731 # This is gross, and probably incorrect too 732 vrefnum, dirid, name = rr.selection[0].as_tuple() 733 pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) 734 pardir_fsr = Carbon.File.FSRef(pardir_fss) 735 pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 736 name_utf8 = unicode(name, 'macroman').encode('utf8') 737 fullpath = os.path.join(pardir_path, name_utf8) 734 738 if issubclass(tpwanted, unicode): 735 739 return unicode(fullpath, 'utf8') -
python/vendor/current/Lib/plat-mac/FrameWork.py
r2 r388 220 220 return 221 221 (what, message, when, where, modifiers) = event 222 if eventname.has_key(what):222 if what in eventname: 223 223 name = "do_" + eventname[what] 224 224 else: … … 251 251 if gotone: 252 252 window = dlg.GetDialogWindow() 253 if self._windows.has_key(window):253 if window in self._windows: 254 254 self._windows[window].do_itemhit(item, event) 255 255 else: … … 265 265 # Find the correct name. 266 266 # 267 if part name.has_key(partcode):267 if partcode in partname: 268 268 name = "do_" + partname[partcode] 269 269 else: … … 280 280 MacOS.HandleEvent(event) 281 281 return 282 elif self._windows.has_key(wid):282 elif wid in self._windows: 283 283 # It is a window. Hand off to correct window. 284 284 window = self._windows[wid] … … 367 367 # See whether the front window wants it 368 368 w = MyFrontWindow() 369 if w and self._windows.has_key(w):369 if w and w in self._windows: 370 370 window = self._windows[w] 371 371 try: … … 382 382 (what, message, when, where, modifiers) = event 383 383 wid = WhichWindow(message) 384 if wid and self._windows.has_key(wid):384 if wid and wid in self._windows: 385 385 window = self._windows[wid] 386 386 window.do_rawupdate(wid, event) … … 392 392 (what, message, when, where, modifiers) = event 393 393 wid = WhichWindow(message) 394 if wid and self._windows.has_key(wid):394 if wid and wid in self._windows: 395 395 window = self._windows[wid] 396 396 window.do_activate(modifiers & 1, event) … … 412 412 (what, message, when, where, modifiers) = event 413 413 wid = MyFrontWindow() 414 if wid and self._windows.has_key(wid):414 if wid and wid in self._windows: 415 415 window = self._windows[wid] 416 416 window.do_activate(message & 1, event) … … 436 436 (what, message, when, where, modifiers) = event 437 437 nicewhat = repr(what) 438 if eventname.has_key(what):438 if what in eventname: 439 439 nicewhat = eventname[what] 440 440 print nicewhat, … … 516 516 if type(callback) == types.StringType: 517 517 wid = MyFrontWindow() 518 if wid and self.parent._windows.has_key(wid):518 if wid and wid in self.parent._windows: 519 519 window = self.parent._windows[wid] 520 520 if hasattr(window, "domenu_" + callback): … … 532 532 533 533 def dispatch(self, id, item, window, event): 534 if self.menus.has_key(id):534 if id in self.menus: 535 535 self.menus[id].dispatch(id, item, window, event) 536 536 else: … … 606 606 title, shortcut, callback, mtype = self.items[item-1] 607 607 if callback: 608 if not self.bar.parent or type(callback) <>types.StringType:608 if not self.bar.parent or type(callback) != types.StringType: 609 609 menuhandler = callback 610 610 else: 611 611 # callback is string 612 612 wid = MyFrontWindow() 613 if wid and self.bar.parent._windows.has_key(wid):613 if wid and wid in self.bar.parent._windows: 614 614 window = self.bar.parent._windows[wid] 615 615 if hasattr(window, "domenu_" + callback): … … 752 752 753 753 def open(self, bounds=(40, 40, 400, 400), resid=None): 754 if resid <>None:754 if resid != None: 755 755 self.wid = GetNewWindow(resid, -1) 756 756 else: … … 830 830 # the activate event. 831 831 # 832 if MyFrontWindow() <>window:832 if MyFrontWindow() != window: 833 833 window.SelectWindow() 834 834 return … … 879 879 880 880 def do_inContent(self, partcode, window, event): 881 if MyFrontWindow() <>window:881 if MyFrontWindow() != window: 882 882 window.SelectWindow() 883 883 return -
python/vendor/current/Lib/plat-mac/MiniAEFrame.py
r2 r388 137 137 _type = _attributes['evid'].type 138 138 139 if self.ae_handlers.has_key((_class, _type)):139 if (_class, _type) in self.ae_handlers: 140 140 _function = self.ae_handlers[(_class, _type)] 141 elif self.ae_handlers.has_key((_class, '****')):141 elif (_class, '****') in self.ae_handlers: 142 142 _function = self.ae_handlers[(_class, '****')] 143 elif self.ae_handlers.has_key(('****', '****')):143 elif ('****', '****') in self.ae_handlers: 144 144 _function = self.ae_handlers[('****', '****')] 145 145 else: … … 151 151 _parameters['_class'] = _class 152 152 _parameters['_type'] = _type 153 if _parameters.has_key('----'):153 if '----' in _parameters: 154 154 _object = _parameters['----'] 155 155 del _parameters['----'] -
python/vendor/current/Lib/plat-mac/aepack.py
r2 r388 133 133 t = desc.type 134 134 135 if unpacker_coercions.has_key(t):135 if t in unpacker_coercions: 136 136 desc = desc.AECoerceDesc(unpacker_coercions[t]) 137 137 t = desc.type # This is a guess by Jack.... -
python/vendor/current/Lib/plat-mac/aetools.py
r2 r388 111 111 ok = keydict.values() 112 112 for k in arguments.keys(): 113 if k eydict.has_key(k):113 if k in keydict: 114 114 v = arguments[k] 115 115 del arguments[k] … … 120 120 def enumsubst(arguments, key, edict): 121 121 """Substitute a single enum keyword argument, if it occurs""" 122 if not arguments.has_key(key)or edict is None:122 if key not in arguments or edict is None: 123 123 return 124 124 v = arguments[key] 125 125 ok = edict.values() 126 if edict.has_key(v):126 if v in edict: 127 127 arguments[key] = Enum(edict[v]) 128 128 elif not v in ok: … … 133 133 errn = arguments['errn'] 134 134 err_a1 = errn 135 if arguments.has_key('errs'):135 if 'errs' in arguments: 136 136 err_a2 = arguments['errs'] 137 137 else: 138 138 err_a2 = MacOS.GetErrorString(errn) 139 if arguments.has_key('erob'):139 if 'erob' in arguments: 140 140 err_a3 = arguments['erob'] 141 141 else: … … 252 252 _reply, _arguments, _attributes = self.send(_code, _subcode, 253 253 _arguments, _attributes) 254 if _arguments.has_key('errn'):254 if 'errn' in _arguments: 255 255 raise Error, decodeerror(_arguments) 256 256 257 if _arguments.has_key('----'):257 if '----' in _arguments: 258 258 return _arguments['----'] 259 259 if asfile: … … 285 285 raise Error, decodeerror(_arguments) 286 286 # XXXX Optionally decode result 287 if _arguments.has_key('----'):287 if '----' in _arguments: 288 288 return _arguments['----'] 289 289 … … 294 294 295 295 def __getattr__(self, name): 296 if self._elemdict.has_key(name):296 if name in self._elemdict: 297 297 cls = self._elemdict[name] 298 298 return DelayedComponentItem(cls, None) 299 if self._propdict.has_key(name):299 if name in self._propdict: 300 300 cls = self._propdict[name] 301 301 return cls() … … 319 319 _reply, _arguments, _attributes = self.send(_code, _subcode, 320 320 _arguments, _attributes) 321 if _arguments.has_key('errn'):321 if 'errn' in _arguments: 322 322 raise Error, decodeerror(_arguments) 323 323 # XXXX Optionally decode result 324 if _arguments.has_key('----'):324 if '----' in _arguments: 325 325 return _arguments['----'] 326 326 #pass -
python/vendor/current/Lib/plat-mac/aetypes.py
r2 r388 132 132 133 133 def __repr__(self): 134 return "Keyword(%r)" % `self.keyword`134 return "Keyword(%r)" % repr(self.keyword) 135 135 136 136 def __str__(self): … … 534 534 535 535 def __getattr__(self, name): 536 if self._elemdict.has_key(name):536 if name in self._elemdict: 537 537 cls = self._elemdict[name] 538 538 return DelayedComponentItem(cls, self) 539 if self._propdict.has_key(name):539 if name in self._propdict: 540 540 cls = self._propdict[name] 541 541 return cls(self) -
python/vendor/current/Lib/plat-mac/appletrunner.py
r2 r388 5 5 6 6 from warnings import warnpy3k 7 warnpy3k("In 3.x, appletrunneris removed.", stacklevel=2)7 warnpy3k("In 3.x, the appletrunner module is removed.", stacklevel=2) 8 8 9 9 import os -
python/vendor/current/Lib/plat-mac/buildtools.py
r2 r388 208 208 if not copy_codefragment: 209 209 skiptypes.append('cfrg') 210 ## skipowner = (ownertype <>None)210 ## skipowner = (ownertype != None) 211 211 212 212 # Copy the resources from the template -
python/vendor/current/Lib/plat-mac/bundlebuilder.py
r2 r388 246 246 """ 247 247 248 if USE_ZIPIMPORT: 249 ZIP_ARCHIVE = "Modules.zip" 250 SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE 251 252 253 254 255 248 ZIP_ARCHIVE = "Modules.zip" 249 SITE_PY_ZIP = SITE_PY + ("sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE) 250 251 def getPycData(fullname, code, ispkg): 252 if ispkg: 253 fullname += ".__init__" 254 path = fullname.replace(".", os.sep) + PYC_EXT 255 return path, MAGIC + '\0\0\0\0' + marshal.dumps(code) 256 256 257 257 # … … 274 274 """ 275 275 276 MAYMISS_MODULES = [' mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',276 MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath', 277 277 'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize', 278 278 'org.python.core', 'riscos', 'riscosenviron', 'riscospath' … … 302 302 mainprogram = os.path.join(resdir, "%(mainprogram)s") 303 303 304 if %(optimize)s: 305 sys.argv.insert(1, '-O') 306 304 307 sys.argv.insert(1, mainprogram) 305 308 if %(standalone)s or %(semi_standalone)s: … … 312 315 pypath = ":" + pypath 313 316 os.environ["PYTHONPATH"] = resdir + pypath 317 314 318 os.environ["PYTHONEXECUTABLE"] = executable 315 319 os.environ["DYLD_LIBRARY_PATH"] = libdir … … 349 353 350 354 class AppBuilder(BundleBuilder): 355 356 use_zipimport = USE_ZIPIMPORT 351 357 352 358 # Override type of the bundle. … … 484 490 self.includeModules.append("argvemulator") 485 491 self.includeModules.append("os") 486 if not self.plist.has_key("CFBundleDocumentTypes"):492 if "CFBundleDocumentTypes" not in self.plist: 487 493 self.plist["CFBundleDocumentTypes"] = [ 488 494 { "CFBundleTypeOSTypes" : [ … … 506 512 standalone = self.standalone 507 513 semi_standalone = self.semi_standalone 514 optimize = sys.flags.optimize 508 515 open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) 509 516 os.chmod(bootstrappath, 0775) … … 552 559 553 560 def _getSiteCode(self): 554 return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, 561 if self.use_zipimport: 562 return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, 555 563 "<-bundlebuilder.py->", "exec") 556 564 … … 558 566 self.message("Adding Python modules", 1) 559 567 560 if USE_ZIPIMPORT:568 if self.use_zipimport: 561 569 # Create a zip file containing all modules as pyc. 562 570 import zipfile … … 624 632 import modulefinder 625 633 mf = modulefinder.ModuleFinder(excludes=self.excludeModules) 626 if USE_ZIPIMPORT:634 if self.use_zipimport: 627 635 # zipimport imports zlib, must add it manually 628 636 mf.import_hook("zlib") … … 658 666 pathitems = name.split(".")[:-1] + [filename] 659 667 dstpath = pathjoin(*pathitems) 660 if USE_ZIPIMPORT:668 if self.use_zipimport: 661 669 if name != "zlib": 662 670 # neatly pack all extension modules in a subdirectory, … … 672 680 if mod.__code__ is not None: 673 681 ispkg = mod.__path__ is not None 674 if not USE_ZIPIMPORTor name != "site":682 if not self.use_zipimport or name != "site": 675 683 # Our site.py is doing the bootstrapping, so we must 676 # include a real .pyc file if USE_ZIPIMPORTis True.684 # include a real .pyc file if self.use_zipimport is True. 677 685 self.pymodules.append((name, mod.__code__, ispkg)) 678 686 … … 820 828 an installed Python, yet includes all third-party 821 829 modules. 830 --no-zipimport Do not copy code into a zip file 822 831 --python=FILE Python to use in #! line in stead of current Python 823 832 --lib=FILE shared library or framework to be copied into … … 847 856 "link-exec", "help", "verbose", "quiet", "argv", "standalone", 848 857 "exclude=", "include=", "package=", "strip", "iconfile=", 849 "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=") 858 "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=" 859 "no-zipimport" 860 ) 850 861 851 862 try: … … 911 922 elif opt == '--destroot': 912 923 builder.destroot = arg 924 elif opt == '--no-zipimport': 925 builder.use_zipimport = False 913 926 914 927 if len(args) != 1: -
python/vendor/current/Lib/plat-mac/cfmfile.py
r2 r388 78 78 Res.UseResFile(currentresref) 79 79 self.parse(data) 80 if self.version <>1:80 if self.version != 1: 81 81 raise error, "unknown 'cfrg' resource format" 82 82 … … 148 148 149 149 def getfragment(self): 150 if self.where <>1:150 if self.where != 1: 151 151 raise error, "can't read fragment, unsupported location" 152 152 f = open(self.path, "rb") … … 160 160 161 161 def copydata(self, outfile): 162 if self.where <>1:162 if self.where != 1: 163 163 raise error, "can't read fragment, unsupported location" 164 164 infile = open(self.path, "rb") -
python/vendor/current/Lib/plat-mac/findertools.py
r2 r388 129 129 """comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window.""" 130 130 object = Carbon.File.FSRef(object) 131 object_alias = object.FSNewAliasM onimal()131 object_alias = object.FSNewAliasMinimal() 132 132 if comment is None: 133 133 return _getcomment(object_alias) … … 144 144 args["data"] = comment 145 145 _reply, args, attrs = finder.send("core", "setd", args, attrs) 146 if args.has_key('errn'):147 raise Error, aetools.decodeerror(args) 148 if args.has_key('----'):146 if 'errn' in args: 147 raise Error, aetools.decodeerror(args) 148 if '----' in args: 149 149 return args['----'] 150 150 … … 157 157 args['----'] = aeobj_01 158 158 _reply, args, attrs = finder.send("core", "getd", args, attrs) 159 if args.has_key('errn'):160 raise Error, aetools.decodeerror(args) 161 if args.has_key('----'):159 if 'errn' in args: 160 raise Error, aetools.decodeerror(args) 161 if '----' in args: 162 162 return args['----'] 163 163 … … 179 179 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None) 180 180 _reply, args, attrs = finder.send('core', 'getd', args, attrs) 181 if args.has_key('errn'):181 if 'errn' in args: 182 182 raise Error, aetools.decodeerror(args) 183 183 p = [] 184 if args.has_key('----'):184 if '----' in args: 185 185 p = args['----'] 186 186 for proc in p: … … 198 198 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=aeobj_0) 199 199 _reply, args, attrs = finder.send('core', 'getd', args, attrs) 200 if args.has_key('errn'):200 if 'errn' in args: 201 201 raise Error, aetools.decodeerror(_arg) 202 if args.has_key('----'):202 if '----' in args: 203 203 p = args['----'] 204 204 creators = p[:] … … 253 253 args['----'] = aeobj_01 254 254 _reply, args, attrs = finder.send("core", "getd", args, attrs) 255 if args.has_key('errn'):256 raise Error, aetools.decodeerror(args) 257 if args.has_key('----'):255 if 'errn' in args: 256 raise Error, aetools.decodeerror(args) 257 if '----' in args: 258 258 return args['----'] 259 259 … … 274 274 args['----'] = aeobj_0 275 275 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) 276 if args.has_key('errn'):276 if 'errn' in args: 277 277 raise Error, aetools.decodeerror(args) 278 278 … … 289 289 args['----'] = aeobj_0 290 290 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) 291 if args.has_key('errn'):291 if 'errn' in args: 292 292 raise Error, aetools.decodeerror(args) 293 293 … … 311 311 args["data"] = [x, y] 312 312 _reply, args, attrs = finder.send("core", "setd", args, attrs) 313 if args.has_key('errn'):313 if 'errn' in args: 314 314 raise Error, aetools.decodeerror(args) 315 315 return (x,y) … … 324 324 args['----'] = aeobj_01 325 325 _reply, args, attrs = finder.send("core", "getd", args, attrs) 326 if args.has_key('errn'):327 raise Error, aetools.decodeerror(args) 328 if args.has_key('----'):326 if 'errn' in args: 327 raise Error, aetools.decodeerror(args) 328 if '----' in args: 329 329 pos = args['----'] 330 330 return pos.h, pos.v … … 349 349 args['----'] = aeobj_01 350 350 _reply, args, attrs = finder.send("core", "getd", args, attrs) 351 if args.has_key('errn'):352 raise Error, aetools.decodeerror(args) 353 if args.has_key('----'):351 if 'errn' in args: 352 raise Error, aetools.decodeerror(args) 353 if '----' in args: 354 354 return args['----'] 355 355 … … 368 368 args["data"] = index 369 369 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) 370 if args.has_key('errn'):370 if 'errn' in args: 371 371 raise Error, aetools.decodeerror(args) 372 372 return index … … 408 408 args['data'] = aeobj_3 409 409 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) 410 if args.has_key('errn'):411 raise Error, aetools.decodeerror(args) 412 if args.has_key('----'):410 if 'errn' in args: 411 raise Error, aetools.decodeerror(args) 412 if '----' in args: 413 413 return args['----'] 414 414 … … 425 425 args['----'] = aeobj_02 426 426 _reply, args, attrs = finder.send("core", "getd", args, attrs) 427 if args.has_key('errn'):427 if 'errn' in args: 428 428 raise Error, aetools.decodeerror(args) 429 429 views = {'iimg':0, 'pnam':1, 'lgbu':2} 430 if args.has_key('----'):430 if '----' in args: 431 431 return views[args['----'].enum] 432 432 … … 460 460 args["data"] = aevar00 461 461 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) 462 if args.has_key('errn'):462 if 'errn' in args: 463 463 raise Error, aetools.decodeerror(args) 464 464 return (w, h) … … 477 477 args['----'] = aeobj_2 478 478 _reply, args, attrs = finder.send('core', 'getd', args, attrs) 479 if args.has_key('errn'):480 raise Error, aetools.decodeerror(args) 481 if args.has_key('----'):479 if 'errn' in args: 480 raise Error, aetools.decodeerror(args) 481 if '----' in args: 482 482 return args['----'] 483 483 … … 508 508 args["data"] = [x, y] 509 509 _reply, args, attrs = finder.send('core', 'setd', args, attrs) 510 if args.has_key('errn'):511 raise Error, aetools.decodeerror(args) 512 if args.has_key('----'):510 if 'errn' in args: 511 raise Error, aetools.decodeerror(args) 512 if '----' in args: 513 513 return args['----'] 514 514 … … 526 526 args['----'] = aeobj_2 527 527 _reply, args, attrs = finder.send('core', 'getd', args, attrs) 528 if args.has_key('errn'):529 raise Error, aetools.decodeerror(args) 530 if args.has_key('----'):528 if 'errn' in args: 529 raise Error, aetools.decodeerror(args) 530 if '----' in args: 531 531 return args['----'] 532 532 … … 553 553 args['----'] = aeobj_01 554 554 _reply, args, attrs = finder.send("core", "getd", args, attrs) 555 if args.has_key('errn'):556 raise Error, aetools.decodeerror(args) 557 if args.has_key('----'):555 if 'errn' in args: 556 raise Error, aetools.decodeerror(args) 557 if '----' in args: 558 558 return args['----'] 559 559 … … 570 570 args["data"] = icondata 571 571 _reply, args, attrs = finder.send("core", "setd", args, attrs) 572 if args.has_key('errn'):573 raise Error, aetools.decodeerror(args) 574 if args.has_key('----'):572 if 'errn' in args: 573 raise Error, aetools.decodeerror(args) 574 if '----' in args: 575 575 return args['----'].data 576 576 … … 595 595 args['----'] = volume 596 596 _reply, args, attrs = finder.send("aevt", "mvol", args, attrs) 597 if args.has_key('errn'):598 raise Error, aetools.decodeerror(args) 599 if args.has_key('----'):597 if 'errn' in args: 598 raise Error, aetools.decodeerror(args) 599 if '----' in args: 600 600 return args['----'] 601 601 … … 611 611 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None) 612 612 _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs) 613 if args.has_key('errn'):614 raise Error, aetools.decodeerror(args) 615 if args.has_key('----'):613 if 'errn' in args: 614 raise Error, aetools.decodeerror(args) 615 if '----' in args: 616 616 return args['----'] 617 617 … … 632 632 args['----'] = level 633 633 _reply, args, attrs = finder.send("aevt", "stvl", args, attrs) 634 if args.has_key('errn'):635 raise Error, aetools.decodeerror(args) 636 if args.has_key('----'):634 if 'errn' in args: 635 raise Error, aetools.decodeerror(args) 636 if '----' in args: 637 637 return args['----'] 638 638 … … 645 645 args['----'] = aeobj_00 646 646 _reply, args, attrs = finder.send("core", "getd", args, attrs) 647 if args.has_key('errn'):648 raise Error, aetools.decodeerror(args) 649 if args.has_key('----'):647 if 'errn' in args: 648 raise Error, aetools.decodeerror(args) 649 if '----' in args: 650 650 return args['----'] 651 651 … … 662 662 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None) 663 663 _reply, args, attrs = finder.send("core", "getd", args, attrs) 664 if args.has_key('errn'):665 raise Error, aetools.decodeerror(args) 666 if args.has_key('----'):664 if 'errn' in args: 665 raise Error, aetools.decodeerror(args) 666 if '----' in args: 667 667 if args['----'] == 0: 668 668 status = -1 … … 674 674 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None) 675 675 _reply, args, attrs = finder.send("core", "getd", args, attrs) 676 if args.has_key('errn'):677 raise Error, aetools.decodeerror(args) 678 if args.has_key('----'):676 if 'errn' in args: 677 raise Error, aetools.decodeerror(args) 678 if '----' in args: 679 679 if args['----'] == 1: 680 680 status = 0 … … 694 694 args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None) 695 695 _reply, args, attrs = finder.send("fndr", "empt", args, attrs) 696 if args.has_key('errn'):696 if 'errn' in args: 697 697 raise aetools.Error, aetools.decodeerror(args) 698 698 -
python/vendor/current/Lib/plat-mac/gensuitemodule.py
r2 r388 173 173 aetelist.append((aete, res.GetResInfo())) 174 174 finally: 175 if rf <>cur:175 if rf != cur: 176 176 CloseResFile(rf) 177 177 UseResFile(cur) … … 336 336 if f.tell() & 1: 337 337 c = f.read(1) 338 ##if c <>'\0':338 ##if c != '\0': 339 339 ## print align:', repr(c) 340 340 … … 593 593 self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0] 594 594 595 if self.basepackage and self.basepackage._code_to_module.has_key(code):595 if self.basepackage and code in self.basepackage._code_to_module: 596 596 # We are an extension of a baseclass (usually an application extending 597 597 # Standard_Suite or so). Import everything from our base module … … 660 660 fp.write('import MacOS\n\n') 661 661 fp.write("_code = %r\n\n"% (code,)) 662 if self.basepackage and self.basepackage._code_to_module.has_key(code):662 if self.basepackage and code in self.basepackage._code_to_module: 663 663 # We are an extension of a baseclass (usually an application extending 664 664 # Standard_Suite or so). Import everything from our base module 665 665 fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0]) 666 666 basemodule = self.basepackage._code_to_module[code] 667 elif self.basepackage and self.basepackage._code_to_module.has_key(code.lower()):667 elif self.basepackage and code.lower() in self.basepackage._code_to_module: 668 668 # This is needed by CodeWarrior and some others. 669 669 fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0]) … … 783 783 kname = a[1] 784 784 ename = a[2][0] 785 if ename <>'****':785 if ename != '****': 786 786 fp.write(" aetools.enumsubst(_arguments, %r, _Enum_%s)\n" % 787 787 (kname, identify(ename))) … … 802 802 # Decode result 803 803 # 804 fp.write(" if _arguments.has_key('----'):\n")804 fp.write(" if '----' in _arguments:\n") 805 805 if is_enum(returns): 806 806 fp.write(" # XXXX Should do enum remapping here...\n") … … 814 814 if is_enum(a[2]): 815 815 ename = a[2][0] 816 if ename <>'****':816 if ename != '****': 817 817 self.enumsneeded[ename] = 1 818 818 … … 846 846 def addnamecode(self, type, name, code): 847 847 self.name2code[type][name] = code 848 if not self.code2name[type].has_key(code):848 if code not in self.code2name[type]: 849 849 self.code2name[type][code] = name 850 850 851 851 def hasname(self, name): 852 852 for dict in self.name2code.values(): 853 if dict.has_key(name):853 if name in dict: 854 854 return True 855 855 return False 856 856 857 857 def hascode(self, type, code): 858 return self.code2name[type].has_key(code)858 return code in self.code2name[type] 859 859 860 860 def findcodename(self, type, code): -
python/vendor/current/Lib/plat-mac/ic.py
r2 r388 142 142 else: 143 143 key2 = key 144 if _decoder_table.has_key(key2):144 if key2 in _decoder_table: 145 145 decoder = _decoder_table[key2][0] 146 146 else: … … 155 155 else: 156 156 key2 = key 157 if _decoder_table.has_key(key2):157 if key2 in _decoder_table: 158 158 coder = _decoder_table[key2][1] 159 159 else: -
python/vendor/current/Lib/plat-mac/macerrors.py
r2 r388 1580 1580 smBLFieldBad = -309 #ByteLanes field was bad. 1581 1581 smUnExBusErr = -308 #Unexpected BusError 1582 smResrvErr = -307 #Fatal reserved error. Res reved field <>0.1582 smResrvErr = -307 #Fatal reserved error. Reserved field != 0. 1583 1583 smNosInfoArray = -306 #No sInfoArray. Memory Mgr error. 1584 1584 smDisabledSlot = -305 #This slot is disabled (-305 use to be smLWTstBad) -
python/vendor/current/Lib/plat-mac/macresource.py
r2 r388 52 52 # If we're main we look in the current directory 53 53 searchdirs = [os.curdir] 54 if sys.modules.has_key(modname):54 if modname in sys.modules: 55 55 mod = sys.modules[modname] 56 56 if hasattr(mod, '__file__'): … … 78 78 """Open a resource file given by pathname, possibly decoding an 79 79 AppleSingle file""" 80 # No resource fork. We may be on OSX, and this may be either 81 # a data-fork based resource file or a AppleSingle file 82 # from the CVS repository. 80 83 try: 81 refno = Res.FSpOpenResFile(pathname, 1) 82 except (AttributeError, Res.Error), arg: 83 if isinstance(arg, AttributeError) or arg[0] in (-37, -39): 84 # No resource fork. We may be on OSX, and this may be either 85 # a data-fork based resource file or a AppleSingle file 86 # from the CVS repository. 87 try: 88 refno = Res.FSOpenResourceFile(pathname, u'', 1) 89 except Res.Error, arg: 90 if arg[0] != -199: 91 # -199 is "bad resource map" 92 raise 93 else: 94 return refno 95 # Finally try decoding an AppleSingle file 96 pathname = _decode(pathname, verbose=verbose) 97 refno = Res.FSOpenResourceFile(pathname, u'', 1) 98 else: 84 refno = Res.FSOpenResourceFile(pathname, u'', 1) 85 except Res.Error, arg: 86 if arg[0] != -199: 87 # -199 is "bad resource map" 99 88 raise 100 return refno 89 else: 90 return refno 91 # Finally try decoding an AppleSingle file 92 pathname = _decode(pathname, verbose=verbose) 93 refno = Res.FSOpenResourceFile(pathname, u'', 1) 101 94 102 95 def resource_pathname(pathname, verbose=0): … … 104 97 If the pathname given already refers to such a file simply return it, 105 98 otherwise first decode it.""" 99 # No resource fork. We may be on OSX, and this may be either 100 # a data-fork based resource file or a AppleSingle file 101 # from the CVS repository. 106 102 try: 107 refno = Res.FSpOpenResFile(pathname, 1) 108 Res.CloseResFile(refno) 109 except (AttributeError, Res.Error), arg: 110 if isinstance(arg, AttributeError) or arg[0] in (-37, -39): 111 # No resource fork. We may be on OSX, and this may be either 112 # a data-fork based resource file or a AppleSingle file 113 # from the CVS repository. 114 try: 115 refno = Res.FSOpenResourceFile(pathname, u'', 1) 116 except Res.Error, arg: 117 if arg[0] != -199: 118 # -199 is "bad resource map" 119 raise 120 else: 121 return refno 122 # Finally try decoding an AppleSingle file 123 pathname = _decode(pathname, verbose=verbose) 124 else: 103 refno = Res.FSOpenResourceFile(pathname, u'', 1) 104 except Res.Error, arg: 105 if arg[0] != -199: 106 # -199 is "bad resource map" 125 107 raise 108 else: 109 return refno 110 # Finally try decoding an AppleSingle file 111 pathname = _decode(pathname, verbose=verbose) 126 112 return pathname 127 113 -
python/vendor/current/Lib/plat-mac/pimp.py
r2 r388 153 153 keepgoing = True 154 154 download = urllib2.urlopen(url) 155 if download.headers.has_key("content-length"):155 if 'content-length' in download.headers: 156 156 length = long(download.headers['content-length']) 157 157 else: … … 421 421 for p in packages: 422 422 p = dict(p) 423 if p.has_key('Download-URL'):423 if 'Download-URL' in p: 424 424 p['Download-URL'] = urllib.basejoin(url, p['Download-URL']) 425 425 flavor = p.get('Flavor') … … 553 553 554 554 rv = self._dict['Name'] 555 if self._dict.has_key('Version'):555 if 'Version' in self._dict: 556 556 rv = rv + '-%s' % self._dict['Version'] 557 if self._dict.has_key('Flavor'):557 if 'Flavor' in self._dict: 558 558 rv = rv + '-%s' % self._dict['Flavor'] 559 559 if self._dict.get('Flavor') == 'hidden': … … 648 648 else: 649 649 name = item['Name'] 650 if item.has_key('Version'):650 if 'Version' in item: 651 651 name = name + '-' + item['Version'] 652 if item.has_key('Flavor'):652 if 'Flavor' in item: 653 653 name = name + '-' + item['Flavor'] 654 654 pkg = self._db.find(name) … … 801 801 will receive a log of what happened.""" 802 802 803 if self._dict.has_key('Install-command'):803 if 'Install-command' in self._dict: 804 804 return "%s: Binary package cannot have Install-command" % self.fullname() 805 805 806 if self._dict.has_key('Pre-install-command'):806 if 'Pre-install-command' in self._dict: 807 807 if _cmd(output, '/tmp', self._dict['Pre-install-command']): 808 808 return "pre-install %s: running \"%s\" failed" % \ … … 837 837 self.afterInstall() 838 838 839 if self._dict.has_key('Post-install-command'):839 if 'Post-install-command' in self._dict: 840 840 if _cmd(output, '/tmp', self._dict['Post-install-command']): 841 841 return "%s: post-install: running \"%s\" failed" % \ … … 862 862 will receive a log of what happened.""" 863 863 864 if self._dict.has_key('Pre-install-command'):864 if 'Pre-install-command' in self._dict: 865 865 if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): 866 866 return "pre-install %s: running \"%s\" failed" % \ … … 899 899 self.afterInstall() 900 900 901 if self._dict.has_key('Post-install-command'):901 if 'Post-install-command' in self._dict: 902 902 if _cmd(output, self._buildDirname, self._dict['Post-install-command']): 903 903 return "post-install %s: running \"%s\" failed" % \ … … 917 917 will receive a log of what happened.""" 918 918 919 if self._dict.has_key('Post-install-command'):919 if 'Post-install-command' in self._dict: 920 920 return "%s: Installer package cannot have Post-install-command" % self.fullname() 921 921 922 if self._dict.has_key('Pre-install-command'):922 if 'Pre-install-command' in self._dict: 923 923 if _cmd(output, '/tmp', self._dict['Pre-install-command']): 924 924 return "pre-install %s: running \"%s\" failed" % \ -
python/vendor/current/Lib/plat-mac/videoreader.py
r2 r388 239 239 height = self.videodescr['height'] 240 240 start = 0 241 rv = ''241 rv = [] 242 242 for i in range(height): 243 243 nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) 244 244 start = start + rowbytes 245 rv = rv + nextline246 return rv245 rv.append(nextline) 246 return ''.join(rv) 247 247 248 248 def reader(url): … … 256 256 import EasyDialogs 257 257 try: 258 import img258 from PIL import Image 259 259 except ImportError: 260 img= None260 Image = None 261 261 import MacOS 262 262 Qt.EnterMovies() … … 278 278 num = num+1 279 279 pname = os.path.join(dstdir, fname) 280 if not img: print 'Not',280 if not Image: print 'Not', 281 281 print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) 282 if img: 283 wrt = img.writer(imgfmt, pname) 284 wrt.width = imgw 285 wrt.height = imgh 286 wrt.write(data) 282 if Image: 283 img = Image.fromstring("RGBA", (imgw, imgh), data) 284 img.save(pname, 'JPEG') 287 285 timestamp, data = rdr.ReadVideo() 288 286 MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG')
Note:
See TracChangeset
for help on using the changeset viewer.