From a312c3ade77a5852c00fd4216626d0423272904a Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Thu, 6 Jun 2002 18:30:10 +0000 Subject: Remove uses of string module and stat.ST_MODE --- Lib/compiler/pyassem.py | 7 +++---- Lib/compiler/pycodegen.py | 8 +++----- Lib/compiler/transformer.py | 3 +-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py index 26b9001..10a8dbd 100644 --- a/Lib/compiler/pyassem.py +++ b/Lib/compiler/pyassem.py @@ -2,7 +2,6 @@ import dis import new -import string import sys import types @@ -246,7 +245,7 @@ class Block: def __str__(self): insts = map(str, self.insts) return "" % (self.label, self.bid, - string.join(insts, '\n')) + '\n'.join(insts)) def emit(self, inst): op = inst[0] @@ -713,10 +712,10 @@ class LineAddrTable: self.lastoff = self.codeOffset def getCode(self): - return string.join(self.code, '') + return ''.join(self.code) def getTable(self): - return string.join(map(chr, self.lnotab), '') + return ''.join(map(chr, self.lnotab)) class StackDepthTracker: # XXX 1. need to keep track of stack depth on jumps diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py index c107a08..a0aa73a 100644 --- a/Lib/compiler/pycodegen.py +++ b/Lib/compiler/pycodegen.py @@ -1,8 +1,6 @@ import imp import os import marshal -import stat -import string import struct import sys import types @@ -135,7 +133,7 @@ class Module(AbstractCompileMode): # calling the interface that would also generate a 1-byte code # to indicate the type of the value. simplest way to get the # same effect is to call marshal and then skip the code. - mtime = os.stat(self.filename)[stat.ST_MTIME] + mtime = os.path.getmtime(self.filename) mtime = struct.pack('i', mtime) return self.MAGIC + mtime @@ -764,7 +762,7 @@ class CodeGenerator: if VERSION > 1: self.emit('LOAD_CONST', None) self.emit('IMPORT_NAME', name) - mod = string.split(name, ".")[0] + mod = name.split(".")[0] self.storeName(alias or mod) def visitFrom(self, node): @@ -790,7 +788,7 @@ class CodeGenerator: self.emit('POP_TOP') def _resolveDots(self, name): - elts = string.split(name, ".") + elts = name.split(".") if len(elts) == 1: return for elt in elts[1:]: diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 32a4160..382ea41 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -28,7 +28,6 @@ import parser # 1.5.2 for code branches executed in 1.5.2 import symbol import token -import string import sys error = 'walker.error' @@ -111,7 +110,7 @@ class Transformer: def parsesuite(self, text): """Return a modified parse tree for the given suite text.""" # Hack for handling non-native line endings on non-DOS like OSs. - text = string.replace(text, '\x0d', '') + text = text.replace('\x0d', '') return self.transform(parser.suite(text)) def parseexpr(self, text): -- cgit v0.12