jiridanek commented on a change in pull request #285: URL: https://github.com/apache/qpid-proton/pull/285#discussion_r557568767
########## File path: tools/python/mllib/__init__.py ########## @@ -43,43 +45,47 @@ from . import transforms from . import parsers + def transform(node, *args): - result = node - for t in args: - if isinstance(t, CLASS_TYPES): - t = t() - result = result.dispatch(t) - return result + result = node + for t in args: + if isinstance(t, CLASS_TYPES): + t = t() + result = result.dispatch(t) + return result + class Resolver: - def __init__(self, path): - self.path = path + def __init__(self, path): + self.path = path + + def resolveEntity(self, publicId, systemId): + for p in self.path: + fname = os.path.join(p, systemId) + if os.path.exists(fname): + source = InputSource(systemId) + source.setByteStream(open(fname)) + return source + return InputSource(systemId) - def resolveEntity(self, publicId, systemId): - for p in self.path: - fname = os.path.join(p, systemId) - if os.path.exists(fname): - source = InputSource(systemId) - source.setByteStream(open(fname)) - return source - return InputSource(systemId) def xml_parse(filename, path=()): - if sys.version_info[0:2] == (2,3): - # XXX: this is for older versions of python - source = "file://%s" % os.path.abspath(filename) - else: - source = filename - h = parsers.XMLParser() - p = xml.sax.make_parser() - p.setContentHandler(h) - p.setErrorHandler(ErrorHandler()) - p.setEntityResolver(Resolver(path)) - p.parse(source) - return h.parser.tree + if sys.version_info[0:2] == (2, 3): + # XXX: this is for older versions of python + source = "file://%s" % os.path.abspath(filename) Review comment: @astitcher ancient remnant of Pythons long gone ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org