# Path: openid/kvform.py
# _LOGGER = logging.getLogger(__name__)
# class KVFormError(ValueError):
# def seqToKV(seq, strict=False):
#     def err(msg):
# def kvToSeq(data, strict=False):
#     def err(msg):
# def dictToKV(d):
# def kvToDict(s):
# 
# Path: openid/oidutil.py
# def autoSubmitHTML(form, title='OpenID transaction in progress'):
# def log(message, level=0):
# def appendArgs(url, args):
# def toBase64(s):
# def fromBase64(s):
#     def __init__(self, name):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __repr__(self):
# def string_to_text(value, deprecate_msg):
# def force_text(value):
# class Symbol(object):
# 
# Path: openid/oidutil.py
# def string_to_text(value, deprecate_msg):
#     """
#     Return input string coverted to text string.
# 
#     If input is text, it is returned as is.
#     If input is binary, it is decoded using UTF-8 to text.
#     """
#     assert isinstance(value, (six.text_type, six.binary_type))
#     if isinstance(value, six.binary_type):
#         warnings.warn(deprecate_msg, DeprecationWarning)
#         value = value.decode('utf-8')
#     return value


import copy
import warnings
import six
from lxml import etree as ElementTree
from six.moves.urllib.parse import urlencode
from openid import kvform, oidutil
from .oidutil import string_to_text
        form = ElementTree.Element('form')

        if form_tag_attrs:
            for name, attr in form_tag_attrs.items():
                form.attrib[name] = attr

        form.attrib['action'] = action_url
        form.attrib['method'] = 'post'
        form.attrib['accept-charset'] = 'UTF-8'
        form.attrib['enctype'] = 'application/x-www-form-urlencoded'

        for name, value in six.iteritems(self.toPostArgs()):
            attrs = {'type': 'hidden', 'name': name, 'value': value}
            form.append(ElementTree.Element('input', attrs))

        submit = ElementTree.Element('input', {'type': 'submit', 'value': submit_text})
        form.append(submit)

        return ElementTree.tostring(form, encoding='unicode')

    def toURL(self, base_url):
        """Generate a GET URL with the parameters in this message
        attached as query parameters."""
        return oidutil.appendArgs(base_url, self.toPostArgs())

    def toKVForm(self):
        """Generate a KVForm string that contains the parameters in
        this message. This will fail if the message contains arguments
        outside of the 'openid.' prefix.
        """

# Path: openid/kvform.py
# _LOGGER = logging.getLogger(__name__)
# class KVFormError(ValueError):
# def seqToKV(seq, strict=False):
#     def err(msg):
# def kvToSeq(data, strict=False):
#     def err(msg):
# def dictToKV(d):
# def kvToDict(s):
# 
# Path: openid/oidutil.py
# def autoSubmitHTML(form, title='OpenID transaction in progress'):
# def log(message, level=0):
# def appendArgs(url, args):
# def toBase64(s):
# def fromBase64(s):
#     def __init__(self, name):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def __hash__(self):
#     def __repr__(self):
# def string_to_text(value, deprecate_msg):
# def force_text(value):
# class Symbol(object):
# 
# Path: openid/oidutil.py
# def string_to_text(value, deprecate_msg):
#     """
#     Return input string coverted to text string.
# 
#     If input is text, it is returned as is.
#     If input is binary, it is decoded using UTF-8 to text.
#     """
#     assert isinstance(value, (six.text_type, six.binary_type))
#     if isinstance(value, six.binary_type):
#         warnings.warn(deprecate_msg, DeprecationWarning)
#         value = value.decode('utf-8')
#     return value


# Path: openid/message.py
import copy
import warnings
import six
from lxml import etree as ElementTree
from six.moves.urllib.parse import urlencode
from openid import kvform, oidutil
from .oidutil import string_to_text

        form = ElementTree.Element('form')

        if form_tag_attrs:
            for name, attr in form_tag_attrs.items():
                form.attrib[name] = attr

        form.attrib['action'] = action_url
        form.attrib['method'] = 'post'
        form.attrib['accept-charset'] = 'UTF-8'
        form.attrib['enctype'] = 'application/x-www-form-urlencoded'

        for name, value in six.iteritems(self.toPostArgs()):
            attrs = {'type': 'hidden', 'name': name, 'value': value}
            form.append(ElementTree.Element('input', attrs))

        submit = ElementTree.Element('input', {'type': 'submit', 'value': submit_text})
        form.append(submit)

        return ElementTree.tostring(form, encoding='unicode')

    def toURL(self, base_url):
        """Generate a GET URL with the parameters in this message
        attached as query parameters."""
        return oidutil.appendArgs(base_url, self.toPostArgs())

    def toKVForm(self):
        """Generate a KVForm string that contains the parameters in
        this message. This will fail if the message contains arguments
        outside of the 'openid.' prefix.
        """

        return kvform.dictToKV(self.toArgs())