mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Use string methods where possible, and remove import string
This commit is contained in:
		
							parent
							
								
									05ab2e693c
								
							
						
					
					
						commit
						7ce734cd72
					
				
					 3 changed files with 11 additions and 13 deletions
				
			
		|  | @ -38,10 +38,10 @@ def updatepos(self, i, j): | |||
|         if i >= j: | ||||
|             return j | ||||
|         rawdata = self.rawdata | ||||
|         nlines = string.count(rawdata, "\n", i, j) | ||||
|         nlines = rawdata.count("\n", i, j) | ||||
|         if nlines: | ||||
|             self.lineno = self.lineno + nlines | ||||
|             pos = string.rindex(rawdata, "\n", i, j) # Should not fail | ||||
|             pos = rawdata.rindex("\n", i, j) # Should not fail | ||||
|             self.offset = j-(pos+1) | ||||
|         else: | ||||
|             self.offset = self.offset + j-i | ||||
|  | @ -176,7 +176,7 @@ def _parse_doctype_element(self, i, declstartpos): | |||
|         # style content model; just skip until '>' | ||||
|         rawdata = self.rawdata | ||||
|         if '>' in rawdata[j:]: | ||||
|             return string.find(rawdata, ">", j) + 1 | ||||
|             return rawdata.find(">", j) + 1 | ||||
|         return -1 | ||||
| 
 | ||||
|     # Internal -- scan past <!ATTLIST declarations | ||||
|  | @ -200,7 +200,7 @@ def _parse_doctype_attlist(self, i, declstartpos): | |||
|             if c == "(": | ||||
|                 # an enumerated type; look for ')' | ||||
|                 if ")" in rawdata[j:]: | ||||
|                     j = string.find(rawdata, ")", j) + 1 | ||||
|                     j = rawdata.find(")", j) + 1 | ||||
|                 else: | ||||
|                     return -1 | ||||
|                 while rawdata[j:j+1] in string.whitespace: | ||||
|  | @ -307,7 +307,7 @@ def _scan_name(self, i, declstartpos): | |||
|             name = s.strip() | ||||
|             if (i + len(s)) == n: | ||||
|                 return None, -1  # end of buffer | ||||
|             return string.lower(name), m.end() | ||||
|             return name.lower(), m.end() | ||||
|         else: | ||||
|             self.updatepos(declstartpos, i) | ||||
|             self.error("expected name token") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Neal Norwitz
						Neal Norwitz