diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-04-17 08:48:32 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-04-17 08:48:32 (GMT) |
commit | 9d72bb452bced3a100f07f8a9e30c4495a9ec41a (patch) | |
tree | c39762a764fcc16f2cfc42e2504e58ff31e159e6 /Lib/plat-mac | |
parent | ff11334927ee616d765b54a3851016b76a20bcec (diff) | |
download | cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.zip cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.gz cpython-9d72bb452bced3a100f07f8a9e30c4495a9ec41a.tar.bz2 |
Remove functions in string module that are also string methods. Also remove:
* all calls to functions in the string module (except maketrans)
* everything from stropmodule except for maketrans() which is still used
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r-- | Lib/plat-mac/EasyDialogs.py | 7 | ||||
-rw-r--r-- | Lib/plat-mac/aepack.py | 2 | ||||
-rw-r--r-- | Lib/plat-mac/aetypes.py | 15 | ||||
-rw-r--r-- | Lib/plat-mac/buildtools.py | 5 | ||||
-rw-r--r-- | Lib/plat-mac/gensuitemodule.py | 4 | ||||
-rw-r--r-- | Lib/plat-mac/ic.py | 5 |
6 files changed, 16 insertions, 22 deletions
diff --git a/Lib/plat-mac/EasyDialogs.py b/Lib/plat-mac/EasyDialogs.py index 3c92011..1bca4cd 100644 --- a/Lib/plat-mac/EasyDialogs.py +++ b/Lib/plat-mac/EasyDialogs.py @@ -30,7 +30,6 @@ from Carbon import Menu from Carbon import AE import Nav import MacOS -import string from Carbon.ControlAccessor import * # Also import Controls constants import Carbon.File import macresource @@ -54,12 +53,12 @@ def _interact(): def cr2lf(text): if '\r' in text: - text = string.join(string.split(text, '\r'), '\n') + text = '\n'.join(text.split('\r')) return text def lf2cr(text): if '\n' in text: - text = string.join(string.split(text, '\n'), '\r') + text = '\r'.join(text.split('\n')) if len(text) > 253: text = text[:253] + '\311' return text @@ -543,7 +542,7 @@ def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfo d.SelectDialogItemText(ARGV_CMDLINE_DATA, 0x7fff, 0x7fff) h = d.GetDialogItemAsControl(ARGV_CMDLINE_DATA) oldstr = GetDialogItemText(h) - tmplist = string.split(oldstr) + tmplist = oldstr.split() newlist = [] while tmplist: item = tmplist[0] diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py index aa1734d..9be242c 100644 --- a/Lib/plat-mac/aepack.py +++ b/Lib/plat-mac/aepack.py @@ -13,9 +13,7 @@ coerce(x, wanted_sample) coerces a python object to another python object # import struct -import string import types -from string import strip from types import * from Carbon import AE from Carbon.AppleEvents import * diff --git a/Lib/plat-mac/aetypes.py b/Lib/plat-mac/aetypes.py index 9dfb39f..9b739f6 100644 --- a/Lib/plat-mac/aetypes.py +++ b/Lib/plat-mac/aetypes.py @@ -3,7 +3,6 @@ from Carbon.AppleEvents import * import struct from types import * -import string # # convoluted, since there are cyclic dependencies between this file and @@ -41,7 +40,7 @@ class Enum: return "Enum(%r)" % (self.enum,) def __str__(self): - return string.strip(self.enum) + return self.enum.strip() def __aepack__(self): return pack(self.enum, typeEnumeration) @@ -108,7 +107,7 @@ class Type: return "Type(%r)" % (self.type,) def __str__(self): - return string.strip(self.type) + return self.type.strip() def __aepack__(self): return pack(self.type, typeType) @@ -131,7 +130,7 @@ class Keyword: return "Keyword(%r)" % self.keyword def __str__(self): - return string.strip(self.keyword) + return self.keyword.strip() def __aepack__(self): return pack(self.keyword, typeKeyword) @@ -170,7 +169,7 @@ class Comparison: return "Comparison(%r, %r, %r)" % (self.obj1, self.relo, self.obj2) def __str__(self): - return "%s %s %s" % (nice(self.obj1), string.strip(self.relo), nice(self.obj2)) + return "%s %s %s" % (nice(self.obj1), self.relo.strip(), nice(self.obj2)) def __aepack__(self): return pack({'obj1': self.obj1, @@ -198,7 +197,7 @@ class Ordinal: return "Ordinal(%r)" % (self.abso,) def __str__(self): - return "%s" % (string.strip(self.abso)) + return "%s" % (self.abso.strip()) def __aepack__(self): return pack(self.abso, 'abso') @@ -225,10 +224,10 @@ class Logical: def __str__(self): if type(self.term) == ListType and len(self.term) == 2: return "%s %s %s" % (nice(self.term[0]), - string.strip(self.logc), + self.logc.strip(), nice(self.term[1])) else: - return "%s(%s)" % (string.strip(self.logc), nice(self.term)) + return "%s(%s)" % (self.logc.strip(), nice(self.term)) def __aepack__(self): return pack({'logc': mkenum(self.logc), 'term': self.term}, 'logi') diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py index 4a0efbf..d2b53b3 100644 --- a/Lib/plat-mac/buildtools.py +++ b/Lib/plat-mac/buildtools.py @@ -2,7 +2,6 @@ import sys import os -import string import imp import marshal from Carbon import Res @@ -86,7 +85,7 @@ def process(template, filename, destname, copy_codefragment=0, # Set the destination file name. Note that basename # does contain the whole filepath, only a .py is stripped. - if string.lower(filename[-3:]) == ".py": + if filename[-3:].lower() == ".py": basename = filename[:-3] if MacOS.runtimemodel != 'macho' and not destname: destname = basename @@ -347,7 +346,7 @@ def copyres(input, output, skiptypes, skipowner, progress=None): for ires in range(1, 1+nresources): res = Res.Get1IndResource(type, ires) id, type, name = res.GetResInfo() - lcname = string.lower(name) + lcname = name.lower() if lcname == OWNERNAME and id == 0: if skipowner: diff --git a/Lib/plat-mac/gensuitemodule.py b/Lib/plat-mac/gensuitemodule.py index fd706a0..6d1ceae 100644 --- a/Lib/plat-mac/gensuitemodule.py +++ b/Lib/plat-mac/gensuitemodule.py @@ -698,7 +698,7 @@ class SuiteCompiler: """Generate class boilerplate""" classname = '%s_Events'%self.modname if self.basemodule: - modshortname = string.split(self.basemodule.__name__, '.')[-1] + modshortname = self.basemodule.__name__.split('.')[-1] baseclassname = '%s_Events'%modshortname self.fp.write("class %s(%s):\n\n"%(classname, baseclassname)) else: @@ -1169,7 +1169,7 @@ def compiledataflags(flags): bits.append(dataflagdict[i]) else: bits.append(repr(i)) - return '[%s]' % string.join(bits) + return '[%s]' % ' '.join(bits) def ascii(str): """Return a string with all non-ascii characters hex-encoded""" diff --git a/Lib/plat-mac/ic.py b/Lib/plat-mac/ic.py index 5c109d6..769400a 100644 --- a/Lib/plat-mac/ic.py +++ b/Lib/plat-mac/ic.py @@ -1,7 +1,6 @@ """IC wrapper module, based on Internet Config 1.3""" import icglue -import string import sys import os from Carbon import Res @@ -135,7 +134,7 @@ _decoder_table = { def _decode(data, key): if '\245' in key: - key2 = key[:string.index(key, '\245')+1] + key2 = key[:key.index('\245')+1] else: key2 = key if key2 in _decoder_table: @@ -148,7 +147,7 @@ def _code(data, key): if type(data) == _ICOpaqueDataType: return data.data if '\245' in key: - key2 = key[:string.index(key, '\245')+1] + key2 = key[:key.index('\245')+1] else: key2 = key if key2 in _decoder_table: |