def __init__(self, source):

        xmlstring = source.read()

        if isinstance(xmlstring, unicode):
            xmlstring = xmlstring.encode('utf-8')
        try:
            tree = ElementTree.fromstring(xmlstring)
        except Exception, e:
            try:
                raise e.__class__((xmlstring, e) % "error parsing %r: %s")
            except:
                raise e

        boolean = tree.find(RESULTS_NS_ET + 'boolean')
        results = tree.find(RESULTS_NS_ET + 'results')

        if boolean is not None:
            type_ = 'ASK'
        elif results is not None:
            type_ = 'SELECT'
        else:
            g = Graph()
            try:
                g.parse(data=xmlstring)
                if len(g) == 0:
                    raise
                type_ = 'CONSTRUCT'

            except:
                raise ResultException(
                    "No RDF Graph, result-bindings or boolean answer found!")

        Result.__init__(self, type_)
        if type_ == 'SELECT':
            self.bindings = []
            for result in results:
                r = {}
                for binding in result:
                    r[Variable(binding.get('name'))] = parseTerm(binding[0])
                self.bindings.append(r)

            self.vars = [Variable(x.get("name"))
                         for x in tree.findall(
                         './%shead/%svariable' % (
                             RESULTS_NS_ET, RESULTS_NS_ET))]

        elif type_ == 'ASK':
            self.askAnswer = boolean.text.lower().strip() == "true"
        elif type_ == 'CONSTRUCT':
            self.graph = g
dataset/ETHPy150Open RDFLib/rdflib/rdflib/plugins/sparql/results/xmlresults.py/XMLResult.__init__/swapped operands of `%`