mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Re-arrange things and remove some unused variables/imports to keep pychecker
happy. (This does not cover everything it complained about, though.)
This commit is contained in:
		
							parent
							
								
									c916f5a390
								
							
						
					
					
						commit
						5445f078df
					
				
					 2 changed files with 14 additions and 4 deletions
				
			
		|  | @ -13,6 +13,15 @@ class ParserBase: | |||
|     """Parser base class which provides some common support methods used | ||||
|     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 | ||||
|         self.offset = 0 | ||||
|  | @ -46,7 +55,6 @@ def parse_declaration(self, i): | |||
|         # deployed," this should only be the document type | ||||
|         # declaration ("<!DOCTYPE html...>"). | ||||
|         rawdata = self.rawdata | ||||
|         import sys | ||||
|         j = i + 2 | ||||
|         assert rawdata[i:j] == "<!", "unexpected call to parse_declaration" | ||||
|         if rawdata[j:j+1] in ("-", ""): | ||||
|  | @ -162,12 +170,11 @@ def _parse_doctype_subset(self, i, declstartpos): | |||
| 
 | ||||
|     # 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 '>' | ||||
|         rawdata = self.rawdata | ||||
|         if '>' in rawdata[j:]: | ||||
|             return string.find(rawdata, ">", j) + 1 | ||||
|         return -1 | ||||
|  | @ -304,3 +311,7 @@ def _scan_name(self, i, declstartpos): | |||
|         else: | ||||
|             self.updatepos(declstartpos, i) | ||||
|             self.error("expected name token") | ||||
| 
 | ||||
|     # To be overridden -- handlers for unknown objects | ||||
|     def unknown_decl(self, data): | ||||
|         pass | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake