Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

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  
    55
    66from warnings import warnpy3k
    7 warnpy3k("In 3.x, Carbon is removed.", stacklevel=2)
     7warnpy3k("In 3.x, the Carbon package is removed.", stacklevel=2)
  • python/vendor/current/Lib/plat-mac/EasyDialogs.py

    r2 r388  
    244244
    245245
    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
     250try:
     251    screenbounds = Qd.GetQDGlobalsScreenBits().bounds
     252except AttributeError:
     253    raise ImportError("QuickDraw APIs not available")
     254
    248255screenbounds = screenbounds[0]+4, screenbounds[1]+4, \
    249256    screenbounds[2]-4, screenbounds[3]-4
     
    581588            del args[k]
    582589    # Set some defaults, and modify some arguments
    583     if not args.has_key('dialogOptionFlags'):
     590    if 'dialogOptionFlags' not in args:
    584591        args['dialogOptionFlags'] = dftflags
    585     if args.has_key('defaultLocation') and \
     592    if 'defaultLocation' in args and \
    586593            not isinstance(args['defaultLocation'], Carbon.AE.AEDesc):
    587594        defaultLocation = args['defaultLocation']
     
    594601            args['defaultLocation'] = Carbon.AE.AECreateDesc(
    595602                    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):
    597604        typeList = args['typeList'][:]
    598605        # Workaround for OSX typeless files:
     
    604611        args['typeList'] = Carbon.Res.Handle(data)
    605612    tpwanted = str
    606     if args.has_key('wanted'):
     613    if 'wanted' in args:
    607614        tpwanted = args['wanted']
    608615        del args['wanted']
     
    722729        return tpwanted(rr.selection[0])
    723730    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)
    734738        if issubclass(tpwanted, unicode):
    735739            return unicode(fullpath, 'utf8')
  • python/vendor/current/Lib/plat-mac/FrameWork.py

    r2 r388  
    220220                return
    221221        (what, message, when, where, modifiers) = event
    222         if eventname.has_key(what):
     222        if what in eventname:
    223223            name = "do_" + eventname[what]
    224224        else:
     
    251251        if gotone:
    252252            window = dlg.GetDialogWindow()
    253             if self._windows.has_key(window):
     253            if window in self._windows:
    254254                self._windows[window].do_itemhit(item, event)
    255255            else:
     
    265265        # Find the correct name.
    266266        #
    267         if partname.has_key(partcode):
     267        if partcode in partname:
    268268            name = "do_" + partname[partcode]
    269269        else:
     
    280280                    MacOS.HandleEvent(event)
    281281                return
    282         elif self._windows.has_key(wid):
     282        elif wid in self._windows:
    283283            # It is a window. Hand off to correct window.
    284284            window = self._windows[wid]
     
    367367            # See whether the front window wants it
    368368            w = MyFrontWindow()
    369             if w and self._windows.has_key(w):
     369            if w and w in self._windows:
    370370                window = self._windows[w]
    371371                try:
     
    382382        (what, message, when, where, modifiers) = event
    383383        wid = WhichWindow(message)
    384         if wid and self._windows.has_key(wid):
     384        if wid and wid in self._windows:
    385385            window = self._windows[wid]
    386386            window.do_rawupdate(wid, event)
     
    392392        (what, message, when, where, modifiers) = event
    393393        wid = WhichWindow(message)
    394         if wid and self._windows.has_key(wid):
     394        if wid and wid in self._windows:
    395395            window = self._windows[wid]
    396396            window.do_activate(modifiers & 1, event)
     
    412412        (what, message, when, where, modifiers) = event
    413413        wid = MyFrontWindow()
    414         if wid and self._windows.has_key(wid):
     414        if wid and wid in self._windows:
    415415            window = self._windows[wid]
    416416            window.do_activate(message & 1, event)
     
    436436        (what, message, when, where, modifiers) = event
    437437        nicewhat = repr(what)
    438         if eventname.has_key(what):
     438        if what in eventname:
    439439            nicewhat = eventname[what]
    440440        print nicewhat,
     
    516516                if type(callback) == types.StringType:
    517517                    wid = MyFrontWindow()
    518                     if wid and self.parent._windows.has_key(wid):
     518                    if wid and wid in self.parent._windows:
    519519                        window = self.parent._windows[wid]
    520520                        if hasattr(window, "domenu_" + callback):
     
    532532
    533533    def dispatch(self, id, item, window, event):
    534         if self.menus.has_key(id):
     534        if id in self.menus:
    535535            self.menus[id].dispatch(id, item, window, event)
    536536        else:
     
    606606        title, shortcut, callback, mtype = self.items[item-1]
    607607        if callback:
    608             if not self.bar.parent or type(callback) <> types.StringType:
     608            if not self.bar.parent or type(callback) != types.StringType:
    609609                menuhandler = callback
    610610            else:
    611611                # callback is string
    612612                wid = MyFrontWindow()
    613                 if wid and self.bar.parent._windows.has_key(wid):
     613                if wid and wid in self.bar.parent._windows:
    614614                    window = self.bar.parent._windows[wid]
    615615                    if hasattr(window, "domenu_" + callback):
     
    752752
    753753    def open(self, bounds=(40, 40, 400, 400), resid=None):
    754         if resid <> None:
     754        if resid != None:
    755755            self.wid = GetNewWindow(resid, -1)
    756756        else:
     
    830830        # the activate event.
    831831        #
    832         if MyFrontWindow() <> window:
     832        if MyFrontWindow() != window:
    833833            window.SelectWindow()
    834834            return
     
    879879
    880880    def do_inContent(self, partcode, window, event):
    881         if MyFrontWindow() <> window:
     881        if MyFrontWindow() != window:
    882882            window.SelectWindow()
    883883            return
  • python/vendor/current/Lib/plat-mac/MiniAEFrame.py

    r2 r388  
    137137        _type = _attributes['evid'].type
    138138
    139         if self.ae_handlers.has_key((_class, _type)):
     139        if (_class, _type) in self.ae_handlers:
    140140            _function = self.ae_handlers[(_class, _type)]
    141         elif self.ae_handlers.has_key((_class, '****')):
     141        elif (_class, '****') in self.ae_handlers:
    142142            _function = self.ae_handlers[(_class, '****')]
    143         elif self.ae_handlers.has_key(('****', '****')):
     143        elif ('****', '****') in self.ae_handlers:
    144144            _function = self.ae_handlers[('****', '****')]
    145145        else:
     
    151151        _parameters['_class'] = _class
    152152        _parameters['_type'] = _type
    153         if _parameters.has_key('----'):
     153        if '----' in _parameters:
    154154            _object = _parameters['----']
    155155            del _parameters['----']
  • python/vendor/current/Lib/plat-mac/aepack.py

    r2 r388  
    133133    t = desc.type
    134134
    135     if unpacker_coercions.has_key(t):
     135    if t in unpacker_coercions:
    136136        desc = desc.AECoerceDesc(unpacker_coercions[t])
    137137        t = desc.type # This is a guess by Jack....
  • python/vendor/current/Lib/plat-mac/aetools.py

    r2 r388  
    111111    ok = keydict.values()
    112112    for k in arguments.keys():
    113         if keydict.has_key(k):
     113        if k in keydict:
    114114            v = arguments[k]
    115115            del arguments[k]
     
    120120def enumsubst(arguments, key, edict):
    121121    """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:
    123123        return
    124124    v = arguments[key]
    125125    ok = edict.values()
    126     if edict.has_key(v):
     126    if v in edict:
    127127        arguments[key] = Enum(edict[v])
    128128    elif not v in ok:
     
    133133    errn = arguments['errn']
    134134    err_a1 = errn
    135     if arguments.has_key('errs'):
     135    if 'errs' in arguments:
    136136        err_a2 = arguments['errs']
    137137    else:
    138138        err_a2 = MacOS.GetErrorString(errn)
    139     if arguments.has_key('erob'):
     139    if 'erob' in arguments:
    140140        err_a3 = arguments['erob']
    141141    else:
     
    252252        _reply, _arguments, _attributes = self.send(_code, _subcode,
    253253                _arguments, _attributes)
    254         if _arguments.has_key('errn'):
     254        if 'errn' in _arguments:
    255255            raise Error, decodeerror(_arguments)
    256256
    257         if _arguments.has_key('----'):
     257        if '----' in _arguments:
    258258            return _arguments['----']
    259259            if asfile:
     
    285285            raise Error, decodeerror(_arguments)
    286286        # XXXX Optionally decode result
    287         if _arguments.has_key('----'):
     287        if '----' in _arguments:
    288288            return _arguments['----']
    289289
     
    294294
    295295    def __getattr__(self, name):
    296         if self._elemdict.has_key(name):
     296        if name in self._elemdict:
    297297            cls = self._elemdict[name]
    298298            return DelayedComponentItem(cls, None)
    299         if self._propdict.has_key(name):
     299        if name in self._propdict:
    300300            cls = self._propdict[name]
    301301            return cls()
     
    319319        _reply, _arguments, _attributes = self.send(_code, _subcode,
    320320                _arguments, _attributes)
    321         if _arguments.has_key('errn'):
     321        if 'errn' in _arguments:
    322322            raise Error, decodeerror(_arguments)
    323323        # XXXX Optionally decode result
    324         if _arguments.has_key('----'):
     324        if '----' in _arguments:
    325325            return _arguments['----']
    326326#pass
  • python/vendor/current/Lib/plat-mac/aetypes.py

    r2 r388  
    132132
    133133    def __repr__(self):
    134         return "Keyword(%r)" % `self.keyword`
     134        return "Keyword(%r)" % repr(self.keyword)
    135135
    136136    def __str__(self):
     
    534534
    535535    def __getattr__(self, name):
    536         if self._elemdict.has_key(name):
     536        if name in self._elemdict:
    537537            cls = self._elemdict[name]
    538538            return DelayedComponentItem(cls, self)
    539         if self._propdict.has_key(name):
     539        if name in self._propdict:
    540540            cls = self._propdict[name]
    541541            return cls(self)
  • python/vendor/current/Lib/plat-mac/appletrunner.py

    r2 r388  
    55
    66from warnings import warnpy3k
    7 warnpy3k("In 3.x, appletrunner is removed.", stacklevel=2)
     7warnpy3k("In 3.x, the appletrunner module is removed.", stacklevel=2)
    88
    99import os
  • python/vendor/current/Lib/plat-mac/buildtools.py

    r2 r388  
    208208    if not copy_codefragment:
    209209        skiptypes.append('cfrg')
    210 ##  skipowner = (ownertype <> None)
     210##  skipowner = (ownertype != None)
    211211
    212212    # Copy the resources from the template
  • python/vendor/current/Lib/plat-mac/bundlebuilder.py

    r2 r388  
    246246"""
    247247
    248 if USE_ZIPIMPORT:
    249     ZIP_ARCHIVE = "Modules.zip"
    250     SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE
    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)
     248ZIP_ARCHIVE = "Modules.zip"
     249SITE_PY_ZIP = SITE_PY + ("sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE)
     250
     251def 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)
    256256
    257257#
     
    274274"""
    275275
    276 MAYMISS_MODULES = ['mac', 'os2', 'nt', 'ntpath', 'dos', 'dospath',
     276MAYMISS_MODULES = ['os2', 'nt', 'ntpath', 'dos', 'dospath',
    277277    'win32api', 'ce', '_winreg', 'nturl2path', 'sitecustomize',
    278278    'org.python.core', 'riscos', 'riscosenviron', 'riscospath'
     
    302302mainprogram = os.path.join(resdir, "%(mainprogram)s")
    303303
     304if %(optimize)s:
     305    sys.argv.insert(1, '-O')
     306
    304307sys.argv.insert(1, mainprogram)
    305308if %(standalone)s or %(semi_standalone)s:
     
    312315        pypath = ":" + pypath
    313316    os.environ["PYTHONPATH"] = resdir + pypath
     317
    314318os.environ["PYTHONEXECUTABLE"] = executable
    315319os.environ["DYLD_LIBRARY_PATH"] = libdir
     
    349353
    350354class AppBuilder(BundleBuilder):
     355
     356    use_zipimport = USE_ZIPIMPORT
    351357
    352358    # Override type of the bundle.
     
    484490                    self.includeModules.append("argvemulator")
    485491                    self.includeModules.append("os")
    486                 if not self.plist.has_key("CFBundleDocumentTypes"):
     492                if "CFBundleDocumentTypes" not in self.plist:
    487493                    self.plist["CFBundleDocumentTypes"] = [
    488494                        { "CFBundleTypeOSTypes" : [
     
    506512            standalone = self.standalone
    507513            semi_standalone = self.semi_standalone
     514            optimize = sys.flags.optimize
    508515            open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals())
    509516            os.chmod(bootstrappath, 0775)
     
    552559
    553560    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},
    555563                     "<-bundlebuilder.py->", "exec")
    556564
     
    558566        self.message("Adding Python modules", 1)
    559567
    560         if USE_ZIPIMPORT:
     568        if self.use_zipimport:
    561569            # Create a zip file containing all modules as pyc.
    562570            import zipfile
     
    624632        import modulefinder
    625633        mf = modulefinder.ModuleFinder(excludes=self.excludeModules)
    626         if USE_ZIPIMPORT:
     634        if self.use_zipimport:
    627635            # zipimport imports zlib, must add it manually
    628636            mf.import_hook("zlib")
     
    658666                pathitems = name.split(".")[:-1] + [filename]
    659667                dstpath = pathjoin(*pathitems)
    660                 if USE_ZIPIMPORT:
     668                if self.use_zipimport:
    661669                    if name != "zlib":
    662670                        # neatly pack all extension modules in a subdirectory,
     
    672680            if mod.__code__ is not None:
    673681                ispkg = mod.__path__ is not None
    674                 if not USE_ZIPIMPORT or name != "site":
     682                if not self.use_zipimport or name != "site":
    675683                    # Our site.py is doing the bootstrapping, so we must
    676                     # include a real .pyc file if USE_ZIPIMPORT is True.
     684                    # include a real .pyc file if self.use_zipimport is True.
    677685                    self.pymodules.append((name, mod.__code__, ispkg))
    678686
     
    820828                         an installed Python, yet includes all third-party
    821829                         modules.
     830      --no-zipimport     Do not copy code into a zip file
    822831      --python=FILE      Python to use in #! line in stead of current Python
    823832      --lib=FILE         shared library or framework to be copied into
     
    847856        "link-exec", "help", "verbose", "quiet", "argv", "standalone",
    848857        "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        )
    850861
    851862    try:
     
    911922        elif opt == '--destroot':
    912923            builder.destroot = arg
     924        elif opt == '--no-zipimport':
     925            builder.use_zipimport = False
    913926
    914927    if len(args) != 1:
  • python/vendor/current/Lib/plat-mac/cfmfile.py

    r2 r388  
    7878                Res.UseResFile(currentresref)
    7979            self.parse(data)
    80             if self.version <> 1:
     80            if self.version != 1:
    8181                raise error, "unknown 'cfrg' resource format"
    8282
     
    148148
    149149    def getfragment(self):
    150         if self.where <> 1:
     150        if self.where != 1:
    151151            raise error, "can't read fragment, unsupported location"
    152152        f = open(self.path, "rb")
     
    160160
    161161    def copydata(self, outfile):
    162         if self.where <> 1:
     162        if self.where != 1:
    163163            raise error, "can't read fragment, unsupported location"
    164164        infile = open(self.path, "rb")
  • python/vendor/current/Lib/plat-mac/findertools.py

    r2 r388  
    129129    """comment: get or set the Finder-comment of the item, displayed in the 'Get Info' window."""
    130130    object = Carbon.File.FSRef(object)
    131     object_alias = object.FSNewAliasMonimal()
     131    object_alias = object.FSNewAliasMinimal()
    132132    if comment is None:
    133133        return _getcomment(object_alias)
     
    144144    args["data"] = comment
    145145    _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:
    149149        return args['----']
    150150
     
    157157    args['----'] = aeobj_01
    158158    _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:
    162162        return args['----']
    163163
     
    179179    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="indx", seld=aetypes.Unknown('abso', "all "), fr=None)
    180180    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
    181     if args.has_key('errn'):
     181    if 'errn' in args:
    182182        raise Error, aetools.decodeerror(args)
    183183    p = []
    184     if args.has_key('----'):
     184    if '----' in args:
    185185        p =  args['----']
    186186        for proc in p:
     
    198198    args['----'] =  aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fcrt'), fr=aeobj_0)
    199199    _reply, args, attrs = finder.send('core', 'getd', args, attrs)
    200     if args.has_key('errn'):
     200    if 'errn' in args:
    201201        raise Error, aetools.decodeerror(_arg)
    202     if args.has_key('----'):
     202    if '----' in args:
    203203        p =  args['----']
    204204        creators = p[:]
     
    253253    args['----'] = aeobj_01
    254254    _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:
    258258        return args['----']
    259259
     
    274274    args['----'] = aeobj_0
    275275    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
    276     if args.has_key('errn'):
     276    if 'errn' in args:
    277277        raise Error, aetools.decodeerror(args)
    278278
     
    289289    args['----'] = aeobj_0
    290290    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
    291     if args.has_key('errn'):
     291    if 'errn' in args:
    292292        raise Error, aetools.decodeerror(args)
    293293
     
    311311    args["data"] = [x, y]
    312312    _reply, args, attrs = finder.send("core", "setd", args, attrs)
    313     if args.has_key('errn'):
     313    if 'errn' in args:
    314314        raise Error, aetools.decodeerror(args)
    315315    return (x,y)
     
    324324    args['----'] = aeobj_01
    325325    _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:
    329329        pos = args['----']
    330330        return pos.h, pos.v
     
    349349    args['----'] = aeobj_01
    350350    _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:
    354354        return args['----']
    355355
     
    368368    args["data"] = index
    369369    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
    370     if args.has_key('errn'):
     370    if 'errn' in args:
    371371        raise Error, aetools.decodeerror(args)
    372372    return index
     
    408408    args['data'] = aeobj_3
    409409    _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:
    413413        return args['----']
    414414
     
    425425    args['----'] = aeobj_02
    426426    _reply, args, attrs = finder.send("core", "getd", args, attrs)
    427     if args.has_key('errn'):
     427    if 'errn' in args:
    428428        raise Error, aetools.decodeerror(args)
    429429    views = {'iimg':0, 'pnam':1, 'lgbu':2}
    430     if args.has_key('----'):
     430    if '----' in args:
    431431        return views[args['----'].enum]
    432432
     
    460460    args["data"] = aevar00
    461461    _reply, args, attrs = finder.send(_code, _subcode, args, attrs)
    462     if args.has_key('errn'):
     462    if 'errn' in args:
    463463        raise Error, aetools.decodeerror(args)
    464464    return (w, h)
     
    477477    args['----'] = aeobj_2
    478478    _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:
    482482        return args['----']
    483483
     
    508508    args["data"] = [x, y]
    509509    _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:
    513513        return args['----']
    514514
     
    526526    args['----'] = aeobj_2
    527527    _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:
    531531        return args['----']
    532532
     
    553553    args['----'] = aeobj_01
    554554    _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:
    558558        return args['----']
    559559
     
    570570    args["data"] = icondata
    571571    _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:
    575575        return args['----'].data
    576576
     
    595595    args['----'] = volume
    596596    _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:
    600600        return args['----']
    601601
     
    611611    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None)
    612612    _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:
    616616        return args['----']
    617617
     
    632632    args['----'] = level
    633633    _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:
    637637        return args['----']
    638638
     
    645645    args['----'] = aeobj_00
    646646    _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:
    650650        return args['----']
    651651
     
    662662    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None)
    663663    _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:
    667667        if args['----'] == 0:
    668668            status = -1
     
    674674    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None)
    675675    _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:
    679679        if args['----'] == 1:
    680680            status = 0
     
    694694    args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None)
    695695    _reply, args, attrs = finder.send("fndr", "empt", args, attrs)
    696     if args.has_key('errn'):
     696    if 'errn' in args:
    697697        raise aetools.Error, aetools.decodeerror(args)
    698698
  • python/vendor/current/Lib/plat-mac/gensuitemodule.py

    r2 r388  
    173173            aetelist.append((aete, res.GetResInfo()))
    174174    finally:
    175         if rf <> cur:
     175        if rf != cur:
    176176            CloseResFile(rf)
    177177            UseResFile(cur)
     
    336336    if f.tell() & 1:
    337337        c = f.read(1)
    338         ##if c <> '\0':
     338        ##if c != '\0':
    339339        ##  print align:', repr(c)
    340340
     
    593593        self.modname = os.path.splitext(os.path.split(self.pathname)[1])[0]
    594594
    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:
    596596            # We are an extension of a baseclass (usually an application extending
    597597            # Standard_Suite or so). Import everything from our base module
     
    660660        fp.write('import MacOS\n\n')
    661661        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:
    663663            # We are an extension of a baseclass (usually an application extending
    664664            # Standard_Suite or so). Import everything from our base module
    665665            fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code][0])
    666666            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:
    668668            # This is needed by CodeWarrior and some others.
    669669            fp.write('from %s import *\n'%self.basepackage._code_to_fullname[code.lower()][0])
     
    783783                kname = a[1]
    784784                ename = a[2][0]
    785                 if ename <> '****':
     785                if ename != '****':
    786786                    fp.write("        aetools.enumsubst(_arguments, %r, _Enum_%s)\n" %
    787787                        (kname, identify(ename)))
     
    802802        # Decode result
    803803        #
    804         fp.write("        if _arguments.has_key('----'):\n")
     804        fp.write("        if '----' in _arguments:\n")
    805805        if is_enum(returns):
    806806            fp.write("            # XXXX Should do enum remapping here...\n")
     
    814814            if is_enum(a[2]):
    815815                ename = a[2][0]
    816                 if ename <> '****':
     816                if ename != '****':
    817817                    self.enumsneeded[ename] = 1
    818818
     
    846846    def addnamecode(self, type, name, code):
    847847        self.name2code[type][name] = code
    848         if not self.code2name[type].has_key(code):
     848        if code not in self.code2name[type]:
    849849            self.code2name[type][code] = name
    850850
    851851    def hasname(self, name):
    852852        for dict in self.name2code.values():
    853             if dict.has_key(name):
     853            if name in dict:
    854854                return True
    855855        return False
    856856
    857857    def hascode(self, type, code):
    858         return self.code2name[type].has_key(code)
     858        return code in self.code2name[type]
    859859
    860860    def findcodename(self, type, code):
  • python/vendor/current/Lib/plat-mac/ic.py

    r2 r388  
    142142    else:
    143143        key2 = key
    144     if _decoder_table.has_key(key2):
     144    if key2 in _decoder_table:
    145145        decoder = _decoder_table[key2][0]
    146146    else:
     
    155155    else:
    156156        key2 = key
    157     if _decoder_table.has_key(key2):
     157    if key2 in _decoder_table:
    158158        coder = _decoder_table[key2][1]
    159159    else:
  • python/vendor/current/Lib/plat-mac/macerrors.py

    r2 r388  
    15801580smBLFieldBad    =   -309    #ByteLanes field was bad.
    15811581smUnExBusErr    =   -308    #Unexpected BusError
    1582 smResrvErr  =   -307    #Fatal reserved error. Resreved field <> 0.
     1582smResrvErr  =   -307    #Fatal reserved error. Reserved field != 0.
    15831583smNosInfoArray  =   -306    #No sInfoArray. Memory Mgr error.
    15841584smDisabledSlot  =   -305    #This slot is disabled (-305 use to be smLWTstBad)
  • python/vendor/current/Lib/plat-mac/macresource.py

    r2 r388  
    5252        # If we're main we look in the current directory
    5353        searchdirs = [os.curdir]
    54     if sys.modules.has_key(modname):
     54    if modname in sys.modules:
    5555        mod = sys.modules[modname]
    5656        if hasattr(mod, '__file__'):
     
    7878    """Open a resource file given by pathname, possibly decoding an
    7979    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.
    8083    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"
    9988            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)
    10194
    10295def resource_pathname(pathname, verbose=0):
     
    10497    If the pathname given already refers to such a file simply return it,
    10598    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.
    106102    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"
    125107            raise
     108    else:
     109        return refno
     110    # Finally try decoding an AppleSingle file
     111    pathname = _decode(pathname, verbose=verbose)
    126112    return pathname
    127113
  • python/vendor/current/Lib/plat-mac/pimp.py

    r2 r388  
    153153        keepgoing = True
    154154        download = urllib2.urlopen(url)
    155         if download.headers.has_key("content-length"):
     155        if 'content-length' in download.headers:
    156156            length = long(download.headers['content-length'])
    157157        else:
     
    421421        for p in packages:
    422422            p = dict(p)
    423             if p.has_key('Download-URL'):
     423            if 'Download-URL' in p:
    424424                p['Download-URL'] = urllib.basejoin(url, p['Download-URL'])
    425425            flavor = p.get('Flavor')
     
    553553
    554554        rv = self._dict['Name']
    555         if self._dict.has_key('Version'):
     555        if 'Version' in self._dict:
    556556            rv = rv + '-%s' % self._dict['Version']
    557         if self._dict.has_key('Flavor'):
     557        if 'Flavor' in self._dict:
    558558            rv = rv + '-%s' % self._dict['Flavor']
    559559        if self._dict.get('Flavor') == 'hidden':
     
    648648            else:
    649649                name = item['Name']
    650                 if item.has_key('Version'):
     650                if 'Version' in item:
    651651                    name = name + '-' + item['Version']
    652                 if item.has_key('Flavor'):
     652                if 'Flavor' in item:
    653653                    name = name + '-' + item['Flavor']
    654654                pkg = self._db.find(name)
     
    801801        will receive a log of what happened."""
    802802
    803         if self._dict.has_key('Install-command'):
     803        if 'Install-command' in self._dict:
    804804            return "%s: Binary package cannot have Install-command" % self.fullname()
    805805
    806         if self._dict.has_key('Pre-install-command'):
     806        if 'Pre-install-command' in self._dict:
    807807            if _cmd(output, '/tmp', self._dict['Pre-install-command']):
    808808                return "pre-install %s: running \"%s\" failed" % \
     
    837837        self.afterInstall()
    838838
    839         if self._dict.has_key('Post-install-command'):
     839        if 'Post-install-command' in self._dict:
    840840            if _cmd(output, '/tmp', self._dict['Post-install-command']):
    841841                return "%s: post-install: running \"%s\" failed" % \
     
    862862        will receive a log of what happened."""
    863863
    864         if self._dict.has_key('Pre-install-command'):
     864        if 'Pre-install-command' in self._dict:
    865865            if _cmd(output, self._buildDirname, self._dict['Pre-install-command']):
    866866                return "pre-install %s: running \"%s\" failed" % \
     
    899899        self.afterInstall()
    900900
    901         if self._dict.has_key('Post-install-command'):
     901        if 'Post-install-command' in self._dict:
    902902            if _cmd(output, self._buildDirname, self._dict['Post-install-command']):
    903903                return "post-install %s: running \"%s\" failed" % \
     
    917917        will receive a log of what happened."""
    918918
    919         if self._dict.has_key('Post-install-command'):
     919        if 'Post-install-command' in self._dict:
    920920            return "%s: Installer package cannot have Post-install-command" % self.fullname()
    921921
    922         if self._dict.has_key('Pre-install-command'):
     922        if 'Pre-install-command' in self._dict:
    923923            if _cmd(output, '/tmp', self._dict['Pre-install-command']):
    924924                return "pre-install %s: running \"%s\" failed" % \
  • python/vendor/current/Lib/plat-mac/videoreader.py

    r2 r388  
    239239        height = self.videodescr['height']
    240240        start = 0
    241         rv = ''
     241        rv = []
    242242        for i in range(height):
    243243            nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4)
    244244            start = start + rowbytes
    245             rv = rv + nextline
    246         return rv
     245            rv.append(nextline)
     246        return ''.join(rv)
    247247
    248248def reader(url):
     
    256256    import EasyDialogs
    257257    try:
    258         import img
     258        from PIL import Image
    259259    except ImportError:
    260         img = None
     260        Image = None
    261261    import MacOS
    262262    Qt.EnterMovies()
     
    278278        num = num+1
    279279        pname = os.path.join(dstdir, fname)
    280         if not img: print 'Not',
     280        if not Image: print 'Not',
    281281        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')
    287285            timestamp, data = rdr.ReadVideo()
    288286            MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG')
Note: See TracChangeset for help on using the changeset viewer.