<commit_before>"""
OAuth token endpoint support.
"""
from zope.interface import Attribute, Interface, implements


class ITokenRequest(Interface):
    client = Attribute(
        """
        The authenticated client making the request.

        @type: L{txoauth.clientcred.IClient}
        """)



class IAssertion(ITokenRequest):
    """
    A token request in the form of an assertion.
    """
    assertionType = Attribute(
        """
        The type of this assertion.

        @type: C{str}
        """)

    assertion = Attribute(
        """
        The value of this assertion.

        @type: C{str}
        """)



class _BaseTokenRequest(object):
    implements(ITokenRequest)

    def __init__(self, clientCredentials):
        self._clientCredentials = clientCredentials


    @property
    def clientCredentials(self):
        return self._clientCredentials



class Assertion(_BaseTokenRequest):
    """
    A token request in the form of an assertion.
    """
    implements(IAssertion)

    def __init__(self, clientCredentials, assertionType, assertion):
        super(Assertion, self).__init__(clientCredentials)
        self._assertionType = assertionType
        self._assertion = assertion


    @property
    def assertionType(self):
        return self._assertionType


    @property
    def assertion(self):
       return self._assertion



class EnforcedInvalidationException(Exception):
    """
    Raised when attempting to check an assertion while not invalidating the
    assertion, if the L{txoauth.interfaces.IAssertionStore} does not allow
    that operation.

    The OAuth specification asserts that assertions should be invalidated.
    """



class AssertionNotFound(Exception):
    """
    Raised when an assertion which was attempted to be checked wasn't found.
    """
<commit_msg>Changed ITokenRequest.<commit_after>"""
OAuth token endpoint support.
"""
from zope.interface import Attribute, Interface, implements


class ITokenRequest(Interface):
    clientCredentials = Attribute(
        """
        The client credentials used in the request.

        @type: L{txoauth.clientcred.IClientIdentifier}
        """)



class IAssertion(ITokenRequest):
    """
    A token request in the form of an assertion.
    """
    assertionType = Attribute(
        """
        The type of this assertion.

        @type: C{str}
        """)

    assertion = Attribute(
        """
        The value of this assertion.

        @type: C{str}
        """)



class _BaseTokenRequest(object):
    implements(ITokenRequest)

    def __init__(self, clientCredentials):
        self._clientCredentials = clientCredentials


    @property
    def clientCredentials(self):
        return self._clientCredentials



class Assertion(_BaseTokenRequest):
    """
    A token request in the form of an assertion.
    """
    implements(IAssertion)

    def __init__(self, clientCredentials, assertionType, assertion):
        super(Assertion, self).__init__(clientCredentials)
        self._assertionType = assertionType
        self._assertion = assertion


    @property
    def assertionType(self):
        return self._assertionType


    @property
    def assertion(self):
       return self._assertion



class EnforcedInvalidationException(Exception):
    """
    Raised when attempting to check an assertion while not invalidating the
    assertion, if the L{txoauth.interfaces.IAssertionStore} does not allow
    that operation.

    The OAuth specification asserts that assertions should be invalidated.
    """



class AssertionNotFound(Exception):
    """
    Raised when an assertion which was attempted to be checked wasn't found.
    """

{'fraction_non_alphanumeric': 0.08244897959183674, 'fraction_numerical': 0.0, 'mean_word_length': 2.8291666666666666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '62359', 'n_tokens_mistral': 1011, 'n_tokens_neox': 948, 'n_words': 288}