diff options
author | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
commit | ef87d6ed94780fe00250a551031023aeb2898365 (patch) | |
tree | 1f8989aaaec7ec5f8b2f26498317f2022bf85531 /Lib/plat-mac | |
parent | 572dbf8f1320c0b34b9c786e5c30ba4a4b61b292 (diff) | |
download | cpython-ef87d6ed94780fe00250a551031023aeb2898365.zip cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.gz cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.bz2 |
Rip out all the u"..." literals and calls to unicode().
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r-- | Lib/plat-mac/EasyDialogs.py | 12 | ||||
-rw-r--r-- | Lib/plat-mac/FrameWork.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/aepack.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/buildtools.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/macostools.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/macresource.py | 6 | ||||
-rw-r--r-- | Lib/plat-mac/plistlib.py | 8 |
7 files changed, 17 insertions, 17 deletions
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 1bca4cd..6d157f9 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -662,7 +662,7 @@ def AskFileForOpen( return tpwanted(rr.selection[0]) if issubclass(tpwanted, str): return tpwanted(rr.selection_fsr[0].as_pathname()) - if issubclass(tpwanted, unicode): + if issubclass(tpwanted, str): return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8') raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) @@ -713,7 +713,7 @@ def AskFileForSave( raise TypeError, "Cannot pass wanted=FSRef to AskFileForSave" if issubclass(tpwanted, Carbon.File.FSSpec): return tpwanted(rr.selection[0]) - if issubclass(tpwanted, (str, unicode)): + if issubclass(tpwanted, (str, str)): if sys.platform == 'mac': fullpath = rr.selection[0].as_pathname() else: @@ -722,10 +722,10 @@ def AskFileForSave( pardir_fss = Carbon.File.FSSpec((vrefnum, dirid, '')) pardir_fsr = Carbon.File.FSRef(pardir_fss) pardir_path = pardir_fsr.FSRefMakePath() # This is utf-8 - name_utf8 = unicode(name, 'macroman').encode('utf8') + name_utf8 = str(name, 'macroman').encode('utf8') fullpath = os.path.join(pardir_path, name_utf8) - if issubclass(tpwanted, unicode): - return unicode(fullpath, 'utf8') + if issubclass(tpwanted, str): + return str(fullpath, 'utf8') return tpwanted(fullpath) raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) @@ -775,7 +775,7 @@ def AskFolder( return tpwanted(rr.selection[0]) if issubclass(tpwanted, str): return tpwanted(rr.selection_fsr[0].as_pathname()) - if issubclass(tpwanted, unicode): + if issubclass(tpwanted, str): return tpwanted(rr.selection_fsr[0].as_pathname(), 'utf8') raise TypeError, "Unknown value for argument 'wanted': %s" % repr(tpwanted) diff --git a/Lib/plat-mac/FrameWork.py b/Lib/plat-mac/FrameWork.py index 2a07c99..8a9b3a5 100644 --- a/Lib/plat-mac/FrameWork.py +++ b/Lib/plat-mac/FrameWork.py @@ -561,7 +561,7 @@ class Menu: self.menu.AppendMenu('x') # add a dummy string self.items.append((label, shortcut, callback, kind)) item = len(self.items) - if isinstance(label, unicode): + if isinstance(label, str): self.menu.SetMenuItemTextWithCFString(item, label) else: self.menu.SetMenuItemText(item, label) diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py index 9be242c..3511270 100644 --- a/Lib/plat-mac/aepack.py +++ b/Lib/plat-mac/aepack.py @@ -154,7 +154,7 @@ def unpack(desc, formodulename=""): if t == typeChar: return desc.data if t == typeUnicodeText: - return unicode(desc.data, 'utf16') + return str(desc.data, 'utf16') # typeColorTable coerced to typeAEList # typeComp coerced to extended # typeData returned as unknown diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index d2b53b3..62c456c 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -164,7 +164,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update, output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) except MacOS.Error: destdir, destfile = os.path.split(destname) - Res.FSCreateResourceFile(destdir, unicode(destfile), RESOURCE_FORK_NAME) + Res.FSCreateResourceFile(destdir, str(destfile), RESOURCE_FORK_NAME) output = Res.FSOpenResourceFile(destname, RESOURCE_FORK_NAME, WRITE) # Copy the resources from the target specific resource template, if any diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py index f7ce468..2adc8aa 100644 --- a/Lib/plat-mac/macostools.py +++ b/Lib/plat-mac/macostools.py @@ -42,7 +42,7 @@ def mkalias(src, dst, relative=None): else: alias = srcfsr.FSNewAliasMinimal() - dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, unicode(dstname), + dstfsr, dstfss = Res.FSCreateResourceFile(dstdirfsr, str(dstname), File.FSGetResourceForkName()) h = Res.FSOpenResourceFile(dstfsr, File.FSGetResourceForkName(), 3) resource = Res.Resource(alias.data) diff --git a/Lib/plat-mac/macresource.py b/Lib/plat-mac/macresource.py index fa14c04..fc8b381 100644 --- a/Lib/plat-mac/macresource.py +++ b/Lib/plat-mac/macresource.py @@ -82,7 +82,7 @@ def open_pathname(pathname, verbose=0): # a data-fork based resource file or a AppleSingle file # from the CVS repository. try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) + refno = Res.FSOpenResourceFile(pathname, '', 1) except Res.Error as arg: if arg[0] != -199: # -199 is "bad resource map" @@ -91,7 +91,7 @@ def open_pathname(pathname, verbose=0): return refno # Finally try decoding an AppleSingle file pathname = _decode(pathname, verbose=verbose) - refno = Res.FSOpenResourceFile(pathname, u'', 1) + refno = Res.FSOpenResourceFile(pathname, '', 1) else: raise return refno @@ -109,7 +109,7 @@ def resource_pathname(pathname, verbose=0): # a data-fork based resource file or a AppleSingle file # from the CVS repository. try: - refno = Res.FSOpenResourceFile(pathname, u'', 1) + refno = Res.FSOpenResourceFile(pathname, '', 1) except Res.Error as arg: if arg[0] != -199: # -199 is "bad resource map" diff --git a/Lib/plat-mac/plistlib.py b/Lib/plat-mac/plistlib.py index 0daf3b5..b040237 100644 --- a/Lib/plat-mac/plistlib.py +++ b/Lib/plat-mac/plistlib.py @@ -70,7 +70,7 @@ def readPlist(pathOrFile): usually is a dictionary). """ didOpen = 0 - if isinstance(pathOrFile, (str, unicode)): + if isinstance(pathOrFile, (str, str)): pathOrFile = open(pathOrFile) didOpen = 1 p = PlistParser() @@ -85,7 +85,7 @@ def writePlist(rootObject, pathOrFile): file name or a (writable) file object. """ didOpen = 0 - if isinstance(pathOrFile, (str, unicode)): + if isinstance(pathOrFile, (str, str)): pathOrFile = open(pathOrFile, "w") didOpen = 1 writer = PlistWriter(pathOrFile) @@ -231,7 +231,7 @@ class PlistWriter(DumbXMLWriter): DumbXMLWriter.__init__(self, file, indentLevel, indent) def writeValue(self, value): - if isinstance(value, (str, unicode)): + if isinstance(value, (str, str)): self.simpleElement("string", value) elif isinstance(value, bool): # must switch for bool before int, as bool is a @@ -270,7 +270,7 @@ class PlistWriter(DumbXMLWriter): self.beginElement("dict") items = sorted(d.items()) for key, value in items: - if not isinstance(key, (str, unicode)): + if not isinstance(key, (str, str)): raise TypeError("keys must be strings") self.simpleElement("key", key) self.writeValue(value) |