# 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/message.py
# OPENID_NS = oidutil.Symbol('OpenID namespace')
# 
# 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 time
import six
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.constant_time import bytes_eq
from cryptography.hazmat.primitives.hmac import HMAC
from openid import kvform, oidutil
from openid.message import OPENID_NS
from .oidutil import string_to_text
        self.setAllowedTypes(allowed_types)

    def copy(self):
        return self.__class__(list(self.allowed_types))

    def setAllowedTypes(self, allowed_types):
        """Set the allowed association types, checking to make sure
        each combination is valid."""
        # Convert strings to text
        allowed_types = [
            (string_to_text(a, "Binary values for assoc_type are deprecated. Use text input instead."),
             string_to_text(s, "Binary values for session_type are deprecated. Use text input instead."))
            for a, s in allowed_types]
        for (assoc_type, session_type) in allowed_types:
            checkSessionType(assoc_type, session_type)

        self.allowed_types = allowed_types

    def addAllowedType(self, assoc_type, session_type=None):
        """Add an association type and session type to the allowed
        types list. The assocation/session pairs are tried in the
        order that they are added."""
        if self.allowed_types is None:
            self.allowed_types = []

        if session_type is None:
            available = getSessionTypes(assoc_type)

            if not available:
                raise ValueError('No session available for association type %r'

# 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/message.py
# OPENID_NS = oidutil.Symbol('OpenID namespace')
# 
# 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/association.py
import time
import six
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.constant_time import bytes_eq
from cryptography.hazmat.primitives.hmac import HMAC
from openid import kvform, oidutil
from openid.message import OPENID_NS
from .oidutil import string_to_text

        self.setAllowedTypes(allowed_types)

    def copy(self):
        return self.__class__(list(self.allowed_types))

    def setAllowedTypes(self, allowed_types):
        """Set the allowed association types, checking to make sure
        each combination is valid."""
        # Convert strings to text
        allowed_types = [
            (string_to_text(a, "Binary values for assoc_type are deprecated. Use text input instead."),
             string_to_text(s, "Binary values for session_type are deprecated. Use text input instead."))
            for a, s in allowed_types]
        for (assoc_type, session_type) in allowed_types:
            checkSessionType(assoc_type, session_type)

        self.allowed_types = allowed_types

    def addAllowedType(self, assoc_type, session_type=None):
        """Add an association type and session type to the allowed
        types list. The assocation/session pairs are tried in the
        order that they are added."""
        if self.allowed_types is None:
            self.allowed_types = []

        if session_type is None:
            available = getSessionTypes(assoc_type)

            if not available:
                raise ValueError('No session available for association type %r'

                                 % (assoc_type,))