diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 09:39:08 (GMT) |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-09 09:39:08 (GMT) |
commit | ec3bbdef94703b7a69dcc758a4059046bc4d79f0 (patch) | |
tree | aa8a7040f69dc49f113b704c520bedfbb9ed7a8a /Lib | |
parent | 92852ad9a44183599a98c135e016e66660a91f13 (diff) | |
download | cpython-ec3bbdef94703b7a69dcc758a4059046bc4d79f0.zip cpython-ec3bbdef94703b7a69dcc758a4059046bc4d79f0.tar.gz cpython-ec3bbdef94703b7a69dcc758a4059046bc4d79f0.tar.bz2 |
String method conversion.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/MimeWriter.py | 7 | ||||
-rw-r--r-- | Lib/pre.py | 4 | ||||
-rw-r--r-- | Lib/pyclbr.py | 23 | ||||
-rw-r--r-- | Lib/traceback.py | 12 |
4 files changed, 23 insertions, 23 deletions
diff --git a/Lib/MimeWriter.py b/Lib/MimeWriter.py index 6aab1cd..bb878c1 100644 --- a/Lib/MimeWriter.py +++ b/Lib/MimeWriter.py @@ -7,7 +7,6 @@ MimeWriter - the only thing here. """ -import string import mimetools __all__ = ["MimeWriter"] @@ -87,12 +86,12 @@ class MimeWriter: self._headers = [] def addheader(self, key, value, prefix=0): - lines = string.splitfields(value, "\n") + lines = value.split("\n") while lines and not lines[-1]: del lines[-1] while lines and not lines[0]: del lines[0] for i in range(1, len(lines)): - lines[i] = " " + string.strip(lines[i]) - value = string.joinfields(lines, "\n") + "\n" + lines[i] = " " + lines[i].strip() + value = "\n".join(lines) + "\n" line = key + ": " + value if prefix: self._headers.insert(0, line) @@ -229,7 +229,7 @@ def escape(pattern): if char not in alphanum: if char=='\000': result[i] = '\\000' else: result[i] = '\\'+char - return string.join(result, '') + return ''.join(result) def compile(pattern, flags=0): """compile(pattern[, flags]) -> RegexObject @@ -398,7 +398,7 @@ class RegexObject: append(source[lastmatch:pos]) n = n + 1 append(source[pos:]) - return (string.join(results, ''), n) + return (''.join(results), n) def split(self, source, maxsplit=0): """split(source[, maxsplit=0]) -> list of strings diff --git a/Lib/pyclbr.py b/Lib/pyclbr.py index 43bd32c..305cabb 100644 --- a/Lib/pyclbr.py +++ b/Lib/pyclbr.py @@ -160,11 +160,11 @@ def readmodule_ex(module, path=[], inpackage=0): dict = {} - i = string.rfind(module, '.') + i = module.rfind('.') if i >= 0: # Dotted module name - package = string.strip(module[:i]) - submodule = string.strip(module[i+1:]) + package = module[:i].strip() + submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child @@ -260,15 +260,15 @@ def readmodule_ex(module, path=[], inpackage=0): inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes - inherit = string.strip(inherit[1:-1]) + inherit = inherit[1:-1].strip() names = [] - for n in string.splitfields(inherit, ','): - n = string.strip(n) + for n in inherit.split(','): + n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: - c = string.splitfields(n, '.') + c = n.split('.') if len(c) > 1: # super class # is of the @@ -291,8 +291,8 @@ def readmodule_ex(module, path=[], inpackage=0): elif m.start("Import") >= 0: # import module - for n in string.split(m.group("ImportList"), ','): - n = string.strip(n) + for n in m.group("ImportList").split(','): + n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) @@ -303,7 +303,7 @@ def readmodule_ex(module, path=[], inpackage=0): elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") - names = string.split(m.group("ImportFromList"), ',') + names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) @@ -314,7 +314,7 @@ def readmodule_ex(module, path=[], inpackage=0): # imported module to our name space if they # were mentioned in the list for n in names: - n = string.strip(n) + n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': @@ -334,3 +334,4 @@ def readmodule_ex(module, path=[], inpackage=0): def _indent(ws, _expandtabs=string.expandtabs): return len(_expandtabs(ws, TABWIDTH)) + diff --git a/Lib/traceback.py b/Lib/traceback.py index 7097b8f..834c568 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -18,7 +18,7 @@ def print_list(extracted_list, file=None): _print(file, ' File "%s", line %d, in %s' % (filename,lineno,name)) if line: - _print(file, ' %s' % string.strip(line)) + _print(file, ' %s' % line.strip()) def format_list(extracted_list): """Given a list of tuples as returned by extract_tb() or @@ -31,7 +31,7 @@ def format_list(extracted_list): for filename, lineno, name, line in extracted_list: item = ' File "%s", line %d, in %s\n' % (filename,lineno,name) if line: - item = item + ' %s\n' % string.strip(line) + item = item + ' %s\n' % line.strip() list.append(item) return list @@ -56,7 +56,7 @@ def print_tb(tb, limit=None, file=None): _print(file, ' File "%s", line %d, in %s' % (filename,lineno,name)) line = linecache.getline(filename, lineno) - if line: _print(file, ' ' + string.strip(line)) + if line: _print(file, ' ' + line.strip()) tb = tb.tb_next n = n+1 @@ -85,7 +85,7 @@ def extract_tb(tb, limit = None): filename = co.co_filename name = co.co_name line = linecache.getline(filename, lineno) - if line: line = string.strip(line) + if line: line = line.strip() else: line = None list.append((filename, lineno, name, line)) tb = tb.tb_next @@ -157,7 +157,7 @@ def format_exception_only(etype, value): while i < len(line) and \ line[i] in string.whitespace: i = i+1 - list.append(' %s\n' % string.strip(line)) + list.append(' %s\n' % line.strip()) s = ' ' for c in line[i:offset-1]: if c in string.whitespace: @@ -246,7 +246,7 @@ def extract_stack(f=None, limit = None): filename = co.co_filename name = co.co_name line = linecache.getline(filename, lineno) - if line: line = string.strip(line) + if line: line = line.strip() else: line = None list.append((filename, lineno, name, line)) f = f.f_back |