MCPcopy Create free account
hub / github.com/kurtmckee/feedparser / _scan_name

Method _scan_name

feedparser/html.py:295–316  ·  view source on GitHub ↗

:type i: int :type declstartpos: int :rtype: Tuple[Optional[str], int]

(self, i, declstartpos)

Source from the content-addressed store, hash-verified

293 _new_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9:]*\s*').match
294
295 def _scan_name(self, i, declstartpos):
296 """
297 :type i: int
298 :type declstartpos: int
299 :rtype: Tuple[Optional[str], int]
300 """
301
302 rawdata = self.rawdata
303 n = len(rawdata)
304 if i == n:
305 return None, -1
306 m = self._new_declname_match(rawdata, i)
307 if m:
308 s = m.group()
309 name = s.strip()
310 if (i + len(s)) == n:
311 return None, -1 # end of buffer
312 return name.lower(), m.end()
313 else:
314 self.handle_data(rawdata)
315 # self.updatepos(declstartpos, i)
316 return None, -1
317
318 @staticmethod
319 def convert_charref(name):

Callers

nothing calls this directly

Calls 1

handle_dataMethod · 0.95

Tested by

no test coverage detected