def compose(self, digest=None, basic=None, username=None, password=None,
                challenge=None, path=None, method=None):
        assert username and password
        if basic or not challenge:
            assert not digest
            userpass = "%s:%s" % (username.strip(), password.strip())
            return "Basic %s" % userpass.encode('base64').strip()
        assert challenge and not basic
        path = path or "/"
        (_, realm) = challenge.split('realm="')
        (realm, _) = realm.split('"', 1)
        auth = AbstractDigestAuthHandler()
        auth.add_password(realm, path, username, password)
        (token, challenge) = challenge.split(' ', 1)
        chal = parse_keqv_list(parse_http_list(challenge))
        class FakeRequest(object):
            if six.PY3:
                @property
                def full_url(self):
                    return path

                selector = full_url

                @property
                def data(self):
                    return None
            else:
                def get_full_url(self):
                    return path

                get_selector = get_full_url

                def has_data(self):
                    return False

            def get_method(self):
                return method or "GET"

        retval = auth.get_authorization(FakeRequest(), chal) % "Digest %s"
        return (retval,)
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/httpheaders.py/_Authorization.compose/swapped operands of `%`