[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.19
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
lib64
/
python3.12
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📁 __pycache__
SET
[ DEL ]
📁 asyncio
SET
[ DEL ]
📁 collections
SET
[ DEL ]
📁 concurrent
SET
[ DEL ]
📁 config-3.12-x86_64-linux-gnu
SET
[ DEL ]
📁 ctypes
SET
[ DEL ]
📁 curses
SET
[ DEL ]
📁 dbm
SET
[ DEL ]
📁 email
SET
[ DEL ]
📁 encodings
SET
[ DEL ]
📁 ensurepip
SET
[ DEL ]
📁 html
SET
[ DEL ]
📁 http
SET
[ DEL ]
📁 importlib
SET
[ DEL ]
📁 json
SET
[ DEL ]
📁 lib-dynload
SET
[ DEL ]
📁 lib2to3
SET
[ DEL ]
📁 logging
SET
[ DEL ]
📁 multiprocessing
SET
[ DEL ]
📁 pydoc_data
SET
[ DEL ]
📁 re
SET
[ DEL ]
📁 site-packages
SET
[ DEL ]
📁 sqlite3
SET
[ DEL ]
📁 tomllib
SET
[ DEL ]
📁 unittest
SET
[ DEL ]
📁 urllib
SET
[ DEL ]
📁 venv
SET
[ DEL ]
📁 wsgiref
SET
[ DEL ]
📁 xml
SET
[ DEL ]
📁 xmlrpc
SET
[ DEL ]
📁 zipfile
SET
[ DEL ]
📁 zoneinfo
SET
[ DEL ]
📄 LICENSE.txt
13,936 B
SET
[ EDIT ]
|
[ DEL ]
📄 __future__.py
5,218 B
SET
[ EDIT ]
|
[ DEL ]
📄 __hello__.py
227 B
SET
[ EDIT ]
|
[ DEL ]
📄 _aix_support.py
4,021 B
SET
[ EDIT ]
|
[ DEL ]
📄 _collections_abc.py
32,089 B
SET
[ EDIT ]
|
[ DEL ]
📄 _compat_pickle.py
8,761 B
SET
[ EDIT ]
|
[ DEL ]
📄 _compression.py
5,681 B
SET
[ EDIT ]
|
[ DEL ]
📄 _markupbase.py
14,653 B
SET
[ EDIT ]
|
[ DEL ]
📄 _osx_support.py
22,023 B
SET
[ EDIT ]
|
[ DEL ]
📄 _py_abc.py
6,189 B
SET
[ EDIT ]
|
[ DEL ]
📄 _pydatetime.py
92,087 B
SET
[ EDIT ]
|
[ DEL ]
📄 _pydecimal.py
227,283 B
SET
[ EDIT ]
|
[ DEL ]
📄 _pyio.py
93,593 B
SET
[ EDIT ]
|
[ DEL ]
📄 _pylong.py
10,790 B
SET
[ EDIT ]
|
[ DEL ]
📄 _sitebuiltins.py
3,128 B
SET
[ EDIT ]
|
[ DEL ]
📄 _strptime.py
28,393 B
SET
[ EDIT ]
|
[ DEL ]
📄 _sysconfigdata__linux_x86_64-linux-gnu.py
72,132 B
SET
[ EDIT ]
|
[ DEL ]
📄 _threading_local.py
7,220 B
SET
[ EDIT ]
|
[ DEL ]
📄 _weakrefset.py
5,893 B
SET
[ EDIT ]
|
[ DEL ]
📄 abc.py
6,538 B
SET
[ EDIT ]
|
[ DEL ]
📄 aifc.py
34,211 B
SET
[ EDIT ]
|
[ DEL ]
📄 antigravity.py
500 B
SET
[ EDIT ]
|
[ DEL ]
📄 argparse.py
101,155 B
SET
[ EDIT ]
|
[ DEL ]
📄 ast.py
64,452 B
SET
[ EDIT ]
|
[ DEL ]
📄 base64.py
20,634 B
SET
[ EDIT ]
|
[ DEL ]
📄 bdb.py
33,573 B
SET
[ EDIT ]
|
[ DEL ]
📄 bisect.py
3,423 B
SET
[ EDIT ]
|
[ DEL ]
📄 bz2.py
11,847 B
SET
[ EDIT ]
|
[ DEL ]
📄 cProfile.py
6,555 B
SET
[ EDIT ]
|
[ DEL ]
📄 calendar.py
25,864 B
SET
[ EDIT ]
|
[ DEL ]
📄 cgi.py
34,418 B
SET
[ EDIT ]
|
[ DEL ]
📄 cgitb.py
12,421 B
SET
[ EDIT ]
|
[ DEL ]
📄 chunk.py
5,500 B
SET
[ EDIT ]
|
[ DEL ]
📄 cmd.py
14,873 B
SET
[ EDIT ]
|
[ DEL ]
📄 code.py
10,962 B
SET
[ EDIT ]
|
[ DEL ]
📄 codecs.py
36,870 B
SET
[ EDIT ]
|
[ DEL ]
📄 codeop.py
5,908 B
SET
[ EDIT ]
|
[ DEL ]
📄 colorsys.py
4,062 B
SET
[ EDIT ]
|
[ DEL ]
📄 compileall.py
20,507 B
SET
[ EDIT ]
|
[ DEL ]
📄 configparser.py
53,789 B
SET
[ EDIT ]
|
[ DEL ]
📄 contextlib.py
27,637 B
SET
[ EDIT ]
|
[ DEL ]
📄 contextvars.py
129 B
SET
[ EDIT ]
|
[ DEL ]
📄 copy.py
8,412 B
SET
[ EDIT ]
|
[ DEL ]
📄 copyreg.py
7,614 B
SET
[ EDIT ]
|
[ DEL ]
📄 crypt.py
3,913 B
SET
[ EDIT ]
|
[ DEL ]
📄 csv.py
16,386 B
SET
[ EDIT ]
|
[ DEL ]
📄 dataclasses.py
62,085 B
SET
[ EDIT ]
|
[ DEL ]
📄 datetime.py
268 B
SET
[ EDIT ]
|
[ DEL ]
📄 decimal.py
2,805 B
SET
[ EDIT ]
|
[ DEL ]
📄 difflib.py
83,368 B
SET
[ EDIT ]
|
[ DEL ]
📄 dis.py
30,227 B
SET
[ EDIT ]
|
[ DEL ]
📄 doctest.py
106,749 B
SET
[ EDIT ]
|
[ DEL ]
📄 enum.py
81,540 B
SET
[ EDIT ]
|
[ DEL ]
📄 filecmp.py
10,381 B
SET
[ EDIT ]
|
[ DEL ]
📄 fileinput.py
15,714 B
SET
[ EDIT ]
|
[ DEL ]
📄 fnmatch.py
5,999 B
SET
[ EDIT ]
|
[ DEL ]
📄 fractions.py
38,147 B
SET
[ EDIT ]
|
[ DEL ]
📄 ftplib.py
34,735 B
SET
[ EDIT ]
|
[ DEL ]
📄 functools.py
37,940 B
SET
[ EDIT ]
|
[ DEL ]
📄 genericpath.py
5,572 B
SET
[ EDIT ]
|
[ DEL ]
📄 getopt.py
7,488 B
SET
[ EDIT ]
|
[ DEL ]
📄 getpass.py
5,990 B
SET
[ EDIT ]
|
[ DEL ]
📄 gettext.py
21,320 B
SET
[ EDIT ]
|
[ DEL ]
📄 glob.py
8,732 B
SET
[ EDIT ]
|
[ DEL ]
📄 graphlib.py
9,648 B
SET
[ EDIT ]
|
[ DEL ]
📄 gzip.py
25,402 B
SET
[ EDIT ]
|
[ DEL ]
📄 hashlib.py
9,683 B
SET
[ EDIT ]
|
[ DEL ]
📄 heapq.py
23,024 B
SET
[ EDIT ]
|
[ DEL ]
📄 hmac.py
8,043 B
SET
[ EDIT ]
|
[ DEL ]
📄 imaplib.py
54,209 B
SET
[ EDIT ]
|
[ DEL ]
📄 imghdr.py
4,398 B
SET
[ EDIT ]
|
[ DEL ]
📄 inspect.py
127,125 B
SET
[ EDIT ]
|
[ DEL ]
📄 io.py
3,582 B
SET
[ EDIT ]
|
[ DEL ]
📄 ipaddress.py
81,414 B
SET
[ EDIT ]
|
[ DEL ]
📄 keyword.py
1,073 B
SET
[ EDIT ]
|
[ DEL ]
📄 linecache.py
5,800 B
SET
[ EDIT ]
|
[ DEL ]
📄 locale.py
78,599 B
SET
[ EDIT ]
|
[ DEL ]
📄 lzma.py
13,277 B
SET
[ EDIT ]
|
[ DEL ]
📄 mailbox.py
78,911 B
SET
[ EDIT ]
|
[ DEL ]
📄 mailcap.py
9,333 B
SET
[ EDIT ]
|
[ DEL ]
📄 mimetypes.py
23,037 B
SET
[ EDIT ]
|
[ DEL ]
📄 modulefinder.py
23,699 B
SET
[ EDIT ]
|
[ DEL ]
📄 netrc.py
6,922 B
SET
[ EDIT ]
|
[ DEL ]
📄 nntplib.py
41,087 B
SET
[ EDIT ]
|
[ DEL ]
📄 ntpath.py
32,324 B
SET
[ EDIT ]
|
[ DEL ]
📄 nturl2path.py
2,374 B
SET
[ EDIT ]
|
[ DEL ]
📄 numbers.py
11,467 B
SET
[ EDIT ]
|
[ DEL ]
📄 opcode.py
13,174 B
SET
[ EDIT ]
|
[ DEL ]
📄 operator.py
10,965 B
SET
[ EDIT ]
|
[ DEL ]
📄 optparse.py
60,369 B
SET
[ EDIT ]
|
[ DEL ]
📄 os.py
40,821 B
SET
[ EDIT ]
|
[ DEL ]
📄 pathlib.py
51,052 B
SET
[ EDIT ]
|
[ DEL ]
📄 pdb.py
70,297 B
SET
[ EDIT ]
|
[ DEL ]
📄 pickle.py
66,911 B
SET
[ EDIT ]
|
[ DEL ]
📄 pickletools.py
94,052 B
SET
[ EDIT ]
|
[ DEL ]
📄 pipes.py
8,978 B
SET
[ EDIT ]
|
[ DEL ]
📄 pkgutil.py
18,281 B
SET
[ EDIT ]
|
[ DEL ]
📄 platform.py
43,388 B
SET
[ EDIT ]
|
[ DEL ]
📄 plistlib.py
28,342 B
SET
[ EDIT ]
|
[ DEL ]
📄 poplib.py
14,742 B
SET
[ EDIT ]
|
[ DEL ]
📄 posixpath.py
17,483 B
SET
[ EDIT ]
|
[ DEL ]
📄 pprint.py
24,158 B
SET
[ EDIT ]
|
[ DEL ]
📄 profile.py
23,092 B
SET
[ EDIT ]
|
[ DEL ]
📄 pstats.py
29,289 B
SET
[ EDIT ]
|
[ DEL ]
📄 pty.py
6,137 B
SET
[ EDIT ]
|
[ DEL ]
📄 py_compile.py
7,837 B
SET
[ EDIT ]
|
[ DEL ]
📄 pyclbr.py
11,396 B
SET
[ EDIT ]
|
[ DEL ]
📄 pydoc.py
113,508 B
SET
[ EDIT ]
|
[ DEL ]
📄 queue.py
11,496 B
SET
[ EDIT ]
|
[ DEL ]
📄 quopri.py
7,183 B
SET
[ EDIT ]
|
[ DEL ]
📄 random.py
34,689 B
SET
[ EDIT ]
|
[ DEL ]
📄 reprlib.py
7,148 B
SET
[ EDIT ]
|
[ DEL ]
📄 rlcompleter.py
7,827 B
SET
[ EDIT ]
|
[ DEL ]
📄 runpy.py
12,885 B
SET
[ EDIT ]
|
[ DEL ]
📄 sched.py
6,351 B
SET
[ EDIT ]
|
[ DEL ]
📄 secrets.py
1,984 B
SET
[ EDIT ]
|
[ DEL ]
📄 selectors.py
19,671 B
SET
[ EDIT ]
|
[ DEL ]
📄 shelve.py
8,560 B
SET
[ EDIT ]
|
[ DEL ]
📄 shlex.py
13,353 B
SET
[ EDIT ]
|
[ DEL ]
📄 shutil.py
56,762 B
SET
[ EDIT ]
|
[ DEL ]
📄 signal.py
2,495 B
SET
[ EDIT ]
|
[ DEL ]
📄 site.py
23,439 B
SET
[ EDIT ]
|
[ DEL ]
📄 smtplib.py
43,531 B
SET
[ EDIT ]
|
[ DEL ]
📄 sndhdr.py
7,448 B
SET
[ EDIT ]
|
[ DEL ]
📄 socket.py
37,815 B
SET
[ EDIT ]
|
[ DEL ]
📄 socketserver.py
28,065 B
SET
[ EDIT ]
|
[ DEL ]
📄 sre_compile.py
231 B
SET
[ EDIT ]
|
[ DEL ]
📄 sre_constants.py
232 B
SET
[ EDIT ]
|
[ DEL ]
📄 sre_parse.py
229 B
SET
[ EDIT ]
|
[ DEL ]
📄 ssl.py
50,904 B
SET
[ EDIT ]
|
[ DEL ]
📄 stat.py
5,485 B
SET
[ EDIT ]
|
[ DEL ]
📄 statistics.py
50,227 B
SET
[ EDIT ]
|
[ DEL ]
📄 string.py
11,786 B
SET
[ EDIT ]
|
[ DEL ]
📄 stringprep.py
12,917 B
SET
[ EDIT ]
|
[ DEL ]
📄 struct.py
257 B
SET
[ EDIT ]
|
[ DEL ]
📄 subprocess.py
88,747 B
SET
[ EDIT ]
|
[ DEL ]
📄 sunau.py
18,478 B
SET
[ EDIT ]
|
[ DEL ]
📄 symtable.py
12,477 B
SET
[ EDIT ]
|
[ DEL ]
📄 sysconfig.py
33,773 B
SET
[ EDIT ]
|
[ DEL ]
📄 tabnanny.py
11,531 B
SET
[ EDIT ]
|
[ DEL ]
📄 tarfile.py
114,250 B
SET
[ EDIT ]
|
[ DEL ]
📄 telnetlib.py
23,334 B
SET
[ EDIT ]
|
[ DEL ]
📄 tempfile.py
32,386 B
SET
[ EDIT ]
|
[ DEL ]
📄 textwrap.py
19,718 B
SET
[ EDIT ]
|
[ DEL ]
📄 this.py
1,003 B
SET
[ EDIT ]
|
[ DEL ]
📄 threading.py
59,742 B
SET
[ EDIT ]
|
[ DEL ]
📄 timeit.py
13,463 B
SET
[ EDIT ]
|
[ DEL ]
📄 token.py
2,511 B
SET
[ EDIT ]
|
[ DEL ]
📄 tokenize.py
21,570 B
SET
[ EDIT ]
|
[ DEL ]
📄 trace.py
29,352 B
SET
[ EDIT ]
|
[ DEL ]
📄 traceback.py
46,393 B
SET
[ EDIT ]
|
[ DEL ]
📄 tracemalloc.py
18,047 B
SET
[ EDIT ]
|
[ DEL ]
📄 tty.py
2,035 B
SET
[ EDIT ]
|
[ DEL ]
📄 types.py
10,993 B
SET
[ EDIT ]
|
[ DEL ]
📄 typing.py
118,836 B
SET
[ EDIT ]
|
[ DEL ]
📄 uu.py
7,341 B
SET
[ EDIT ]
|
[ DEL ]
📄 uuid.py
29,656 B
SET
[ EDIT ]
|
[ DEL ]
📄 warnings.py
21,909 B
SET
[ EDIT ]
|
[ DEL ]
📄 wave.py
22,769 B
SET
[ EDIT ]
|
[ DEL ]
📄 weakref.py
21,513 B
SET
[ EDIT ]
|
[ DEL ]
📄 webbrowser.py
24,141 B
SET
[ EDIT ]
|
[ DEL ]
📄 xdrlib.py
5,942 B
SET
[ EDIT ]
|
[ DEL ]
📄 zipapp.py
7,543 B
SET
[ EDIT ]
|
[ DEL ]
📄 zipimport.py
27,840 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: _markupbase.py
"""Shared support for scanning document type declarations in HTML and XHTML. This module is used as a foundation for the html.parser module. It has no documented public API and should not be used directly. """ import re _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match _declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match _commentclose = re.compile(r'--\s*>') _markedsectionclose = re.compile(r']\s*]\s*>') # An analysis of the MS-Word extensions is available at # http://www.planetpublish.com/xmlarena/xap/Thursday/WordtoXML.pdf _msmarkedsectionclose = re.compile(r']\s*>') del re 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 reset(self): self.lineno = 1 self.offset = 0 def getpos(self): """Return current line number and offset.""" return self.lineno, self.offset # Internal -- update line number and offset. This should be # called for each piece of data exactly once, in order -- in other # words the concatenation of all the input strings to this # function should be exactly the entire input. def updatepos(self, i, j): if i >= j: return j rawdata = self.rawdata nlines = rawdata.count("\n", i, j) if nlines: self.lineno = self.lineno + nlines pos = rawdata.rindex("\n", i, j) # Should not fail self.offset = j-(pos+1) else: self.offset = self.offset + j-i return j _decl_otherchars = '' # Internal -- parse declaration (for use by subclasses). def parse_declaration(self, i): # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). # ISO 8879:1986, however, has more complex # declaration syntax for elements in <!...>, including: # --comment-- # [marked section] # name in the following list: ENTITY, DOCTYPE, ELEMENT, # ATTLIST, NOTATION, SHORTREF, USEMAP, # LINKTYPE, LINK, IDLINK, USELINK, SYSTEM rawdata = self.rawdata j = i + 2 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration" if rawdata[j:j+1] == ">": # the empty comment <!> return j + 1 if rawdata[j:j+1] in ("-", ""): # Start of comment followed by buffer boundary, # or just a buffer boundary. return -1 # A simple, practical version could look like: ((name|stringlit) S*) + '>' n = len(rawdata) if rawdata[j:j+2] == '--': #comment # Locate --.*-- as the body of the comment return self.parse_comment(i) elif rawdata[j] == '[': #marked section # Locate [statusWord [...arbitrary SGML...]] as the body of the marked section # Where statusWord is one of TEMP, CDATA, IGNORE, INCLUDE, RCDATA # Note that this is extended by Microsoft Office "Save as Web" function # to include [if...] and [endif]. return self.parse_marked_section(i) else: #all other declaration elements decltype, j = self._scan_name(j, i) if j < 0: return j if decltype == "doctype": self._decl_otherchars = '' while j < n: c = rawdata[j] if c == ">": # end of declaration syntax data = rawdata[i+2:j] if decltype == "doctype": self.handle_decl(data) else: # According to the HTML5 specs sections "8.2.4.44 Bogus # comment state" and "8.2.4.45 Markup declaration open # state", a comment token should be emitted. # Calling unknown_decl provides more flexibility though. self.unknown_decl(data) return j + 1 if c in "\"'": m = _declstringlit_match(rawdata, j) if not m: return -1 # incomplete j = m.end() elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ": name, j = self._scan_name(j, i) elif c in self._decl_otherchars: j = j + 1 elif c == "[": # this could be handled in a separate doctype parser if decltype == "doctype": j = self._parse_doctype_subset(j + 1, i) elif decltype in {"attlist", "linktype", "link", "element"}: # must tolerate []'d groups in a content model in an element declaration # also in data attribute specifications of attlist declaration # also link type declaration subsets in linktype declarations # also link attribute specification lists in link declarations raise AssertionError("unsupported '[' char in %s declaration" % decltype) else: raise AssertionError("unexpected '[' char in declaration") else: raise AssertionError("unexpected %r char in declaration" % rawdata[j]) if j < 0: return j return -1 # incomplete # Internal -- parse a marked section # Override this to handle MS-word extension syntax <![if word]>content<![endif]> def parse_marked_section(self, i, report=1): rawdata= self.rawdata assert rawdata[i:i+3] == '<![', "unexpected call to parse_marked_section()" sectName, j = self._scan_name( i+3, i ) if j < 0: return j if sectName in {"temp", "cdata", "ignore", "include", "rcdata"}: # look for standard ]]> ending match= _markedsectionclose.search(rawdata, i+3) elif sectName in {"if", "else", "endif"}: # look for MS Office ]> ending match= _msmarkedsectionclose.search(rawdata, i+3) else: raise AssertionError( 'unknown status keyword %r in marked section' % rawdata[i+3:j] ) if not match: return -1 if report: j = match.start(0) self.unknown_decl(rawdata[i+3: j]) return match.end(0) # Internal -- parse comment, return length or -1 if not terminated def parse_comment(self, i, report=1): rawdata = self.rawdata if rawdata[i:i+4] != '<!--': raise AssertionError('unexpected call to parse_comment()') match = _commentclose.search(rawdata, i+4) if not match: return -1 if report: j = match.start(0) self.handle_comment(rawdata[i+4: j]) return match.end(0) # Internal -- scan past the internal subset in a <!DOCTYPE declaration, # returning the index just past any whitespace following the trailing ']'. def _parse_doctype_subset(self, i, declstartpos): rawdata = self.rawdata n = len(rawdata) j = i while j < n: c = rawdata[j] if c == "<": s = rawdata[j:j+2] if s == "<": # end of buffer; incomplete return -1 if s != "<!": self.updatepos(declstartpos, j + 1) raise AssertionError( "unexpected char in internal subset (in %r)" % s ) if (j + 2) == n: # end of buffer; incomplete return -1 if (j + 4) > n: # end of buffer; incomplete return -1 if rawdata[j:j+4] == "<!--": j = self.parse_comment(j, report=0) if j < 0: return j continue name, j = self._scan_name(j + 2, declstartpos) if j == -1: return -1 if name not in {"attlist", "element", "entity", "notation"}: self.updatepos(declstartpos, j + 2) raise AssertionError( "unknown declaration %r in internal subset" % name ) # handle the individual names meth = getattr(self, "_parse_doctype_" + name) j = meth(j, declstartpos) if j < 0: return j elif c == "%": # parameter entity reference if (j + 1) == n: # end of buffer; incomplete return -1 s, j = self._scan_name(j + 1, declstartpos) if j < 0: return j if rawdata[j] == ";": j = j + 1 elif c == "]": j = j + 1 while j < n and rawdata[j].isspace(): j = j + 1 if j < n: if rawdata[j] == ">": return j self.updatepos(declstartpos, j) raise AssertionError("unexpected char after internal subset") else: return -1 elif c.isspace(): j = j + 1 else: self.updatepos(declstartpos, j) raise AssertionError("unexpected char %r in internal subset" % c) # end of buffer reached return -1 # 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 rawdata.find(">", j) + 1 return -1 # Internal -- scan past <!ATTLIST declarations def _parse_doctype_attlist(self, i, declstartpos): rawdata = self.rawdata name, j = self._scan_name(i, declstartpos) c = rawdata[j:j+1] if c == "": return -1 if c == ">": return j + 1 while 1: # scan a series of attribute descriptions; simplified: # name type [value] [#constraint] name, j = self._scan_name(j, declstartpos) if j < 0: return j c = rawdata[j:j+1] if c == "": return -1 if c == "(": # an enumerated type; look for ')' if ")" in rawdata[j:]: j = rawdata.find(")", j) + 1 else: return -1 while rawdata[j:j+1].isspace(): j = j + 1 if not rawdata[j:]: # end of buffer, incomplete return -1 else: name, j = self._scan_name(j, declstartpos) c = rawdata[j:j+1] if not c: return -1 if c in "'\"": m = _declstringlit_match(rawdata, j) if m: j = m.end() else: return -1 c = rawdata[j:j+1] if not c: return -1 if c == "#": if rawdata[j:] == "#": # end of buffer return -1 name, j = self._scan_name(j + 1, declstartpos) if j < 0: return j c = rawdata[j:j+1] if not c: return -1 if c == '>': # all done return j + 1 # Internal -- scan past <!NOTATION declarations def _parse_doctype_notation(self, i, declstartpos): name, j = self._scan_name(i, declstartpos) if j < 0: return j rawdata = self.rawdata while 1: c = rawdata[j:j+1] if not c: # end of buffer; incomplete return -1 if c == '>': return j + 1 if c in "'\"": m = _declstringlit_match(rawdata, j) if not m: return -1 j = m.end() else: name, j = self._scan_name(j, declstartpos) if j < 0: return j # Internal -- scan past <!ENTITY declarations def _parse_doctype_entity(self, i, declstartpos): rawdata = self.rawdata if rawdata[i:i+1] == "%": j = i + 1 while 1: c = rawdata[j:j+1] if not c: return -1 if c.isspace(): j = j + 1 else: break else: j = i name, j = self._scan_name(j, declstartpos) if j < 0: return j while 1: c = self.rawdata[j:j+1] if not c: return -1 if c in "'\"": m = _declstringlit_match(rawdata, j) if m: j = m.end() else: return -1 # incomplete elif c == ">": return j + 1 else: name, j = self._scan_name(j, declstartpos) if j < 0: return j # Internal -- scan a name token and the new position and the token, or # return -1 if we've reached the end of the buffer. def _scan_name(self, i, declstartpos): rawdata = self.rawdata n = len(rawdata) if i == n: return None, -1 m = _declname_match(rawdata, i) if m: s = m.group() name = s.strip() if (i + len(s)) == n: return None, -1 # end of buffer return name.lower(), m.end() else: self.updatepos(declstartpos, i) raise AssertionError( "expected name token at %r" % rawdata[declstartpos:declstartpos+20] ) # To be overridden -- handlers for unknown objects def unknown_decl(self, data): pass