Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv In directory usw-pr-cvs1:/tmp/cvs-serv8115 Modified Files: latex2esis.py Log Message: Modernization: Use string methods, use str instead of types.StringType, inherit from list instead of UserList. Index: latex2esis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/latex2esis.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** latex2esis.py 10 Apr 2002 04:20:33 -0000 1.30 --- latex2esis.py 16 Oct 2002 16:00:42 -0000 1.31 *************** *** 20,31 **** import os import re - import string import sys - import UserList import xml.sax import xml.sax.saxutils - from types import ListType, StringType, TupleType - from esistools import encode --- 20,27 ---- *************** *** 75,95 **** ! class _Stack(UserList.UserList): def append(self, entry): ! if type(entry) is not StringType: raise LaTeXFormatError("cannot push non-string on stack: " + `entry`) #dbgmsg("%s<%s>" % (" "*len(self.data), entry)) ! self.data.append(entry) def pop(self, index=-1): ! entry = self.data[index] ! del self.data[index] ! #dbgmsg("%s</%s>" % (" "*len(self.data), entry)) def __delitem__(self, index): ! entry = self.data[index] ! del self.data[index] ! #dbgmsg("%s</%s>" % (" "*len(self.data), entry)) --- 71,91 ---- ! class _Stack(list): def append(self, entry): ! if not isinstance(entry, str): raise LaTeXFormatError("cannot push non-string on stack: " + `entry`) #dbgmsg("%s<%s>" % (" "*len(self.data), entry)) ! list.append(self, entry) def pop(self, index=-1): ! entry = self[index] ! del self[index] ! #dbgmsg("%s</%s>" % (" " * len(self), entry)) def __delitem__(self, index): ! entry = self[index] ! list.__delitem__(self, index) ! #dbgmsg("%s</%s>" % (" " * len(self), entry)) *************** *** 97,101 **** if DEBUG: return _Stack() ! return [] --- 93,98 ---- if DEBUG: return _Stack() ! else: ! return [] *************** *** 107,111 **** L = [s.rstrip() for s in ifp.readlines()] L.append("") ! self.line = string.join(L, "\n") self.preamble = 1 --- 104,108 ---- L = [s.rstrip() for s in ifp.readlines()] L.append("") ! self.line = "\n".join(L) self.preamble = 1 *************** *** 341,345 **** if stack: raise LaTeXFormatError("elements remain on stack: " ! + string.join(stack, ", ")) # otherwise we just ran out of input here... --- 338,342 ---- if stack: raise LaTeXFormatError("elements remain on stack: " ! + ", ".join(stack)) # otherwise we just ran out of input here... *************** *** 547,551 **** for opt, arg in opts: if opt in ("-D", "--debug"): ! DEBUG = DEBUG + 1 if len(args) == 0: ifp = sys.stdin --- 544,548 ---- for opt, arg in opts: if opt in ("-D", "--debug"): ! DEBUG += 1 if len(args) == 0: ifp = sys.stdin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4