You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2023/04/10 21:45:10 UTC

[qpid-python] 03/06: QPID-8631: `sgmllib.SGMLParser` -> `HTMLParser`

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-python.git

commit 2bc6123f8e80c21c7e765d3deb7528be1b67ff9a
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Sat Apr 8 18:07:40 2023 +0200

    QPID-8631: `sgmllib.SGMLParser` -> `HTMLParser`
---
 mllib/parsers.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/mllib/parsers.py b/mllib/parsers.py
index 3e7cc10..48573f2 100644
--- a/mllib/parsers.py
+++ b/mllib/parsers.py
@@ -21,7 +21,12 @@
 Parsers for SGML and XML to dom.
 """
 
-import sgmllib, xml.sax.handler
+from __future__ import absolute_import
+try:
+  from HTMLParser import HTMLParser
+except ImportError:
+  from html.parser import HTMLParser
+import xml.sax.handler
 from dom import *
 
 class Parser:
@@ -73,10 +78,10 @@ class Parser:
       self.node = self.node.parent
 
 
-class SGMLParser(sgmllib.SGMLParser):
+class SGMLParser(HTMLParser):
 
-  def __init__(self, entitydefs = None):
-    sgmllib.SGMLParser.__init__(self)
+  def __init__(self, entitydefs=None):
+    super(SGMLParser, self).__init__()
     if entitydefs == None:
       self.entitydefs = {}
     else:
@@ -102,7 +107,7 @@ class SGMLParser(sgmllib.SGMLParser):
     self.parser.end(name)
 
   def close(self):
-    sgmllib.SGMLParser.close(self)
+    super(SGMLParser, self).close()
     self.parser.balance()
     assert self.parser.node == self.parser.tree
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org