[Python-checkins] CVS: python/dist/src/Lib sgmllib.py,1.38,1.39 markupbase.py,1.3,1.4
Fred L. Drake
fdrake@users.sourceforge.net
2001年10月26日 11:02:30 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13570
Modified Files:
sgmllib.py markupbase.py
Log Message:
Re-arrange things and remove some unused variables/imports to keep pychecker
happy. (This does not cover everything it complained about, though.)
Index: sgmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** sgmllib.py 2001年09月24日 20:15:51 1.38
--- sgmllib.py 2001年10月26日 18:02:28 1.39
***************
*** 424,428 ****
def unknown_charref(self, ref): pass
def unknown_entityref(self, ref): pass
- def unknown_decl(self, data): pass
--- 424,427 ----
Index: markupbase.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/markupbase.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** markupbase.py 2001年10月13日 15:59:47 1.3
--- markupbase.py 2001年10月26日 18:02:28 1.4
***************
*** 14,17 ****
--- 14,26 ----
by the SGML/HTML and XHTML parsers."""
+ def __init__(self):
+ if self.__class__ is ParserBase:
+ raise RuntimeError(
+ "markupbase.ParserBase must be subclassed")
+
+ def error(self, message):
+ raise NotImplementedError(
+ "subclasses of ParserBase must override error()")
+
def reset(self):
self.lineno = 1
***************
*** 47,51 ****
# declaration ("<!DOCTYPE html...>").
rawdata = self.rawdata
- import sys
j = i + 2
assert rawdata[i:j] == "<!", "unexpected call to parse_declaration"
--- 56,59 ----
***************
*** 163,172 ****
# Internal -- scan past <!ELEMENT declarations
def _parse_doctype_element(self, i, declstartpos):
- rawdata = self.rawdata
- n = len(rawdata)
name, j = self._scan_name(i, declstartpos)
if j == -1:
return -1
# style content model; just skip until '>'
if '>' in rawdata[j:]:
return string.find(rawdata, ">", j) + 1
--- 171,179 ----
# Internal -- scan past <!ELEMENT declarations
def _parse_doctype_element(self, i, declstartpos):
name, j = self._scan_name(i, declstartpos)
if j == -1:
return -1
# style content model; just skip until '>'
+ rawdata = self.rawdata
if '>' in rawdata[j:]:
return string.find(rawdata, ">", j) + 1
***************
*** 305,306 ****
--- 312,317 ----
self.updatepos(declstartpos, i)
self.error("expected name token")
+
+ # To be overridden -- handlers for unknown objects
+ def unknown_decl(self, data):
+ pass