aiosasl/__init__.py
def from_reply(cls, state):
        """
        Comptaibility layer for old :class:`SASLInterface`
        implementations.

        Accepts the follwing set of :class:`SASLState` or strings and
        maps the strings to :class:`SASLState` elements as follows:

          ``"challenge"``
            :member:`SASLState.CHALLENGE`

           ``"failue"``
             :member:`SASLState.FAILURE`

           ``"success"``
             :member:`SASLState.SUCCESS`
        """
        if state in (SASLState.FAILURE, SASLState.SUCCESS,
                     SASLState.CHALLENGE):
            return state

        if state in ("failure", "success", "challenge"):
            return SASLState(state)
        else:
            raise RuntimeError("invalid SASL state", state)
def from_reply(cls, state):
        """
        Comptaibility layer for old :class:`SASLInterface`
        implementations.

        Accepts the follwing set of :class:`SASLState` or strings and
        maps the strings to :class:`SASLState` elements as follows:

          ``"challenge"``
            :member:`SASLState.CHALLENGE`

           ``"failue"``
             :member:`SASLState.FAILURE`

           ``"success"``
             :member:`SASLState.SUCCESS`
        """
        if state in (SASLState.FAILURE, SASLState.SUCCESS,
                     SASLState.CHALLENGE):
            return state

        if state in ("failure", "success", "challenge"):
            return SASLState(state)
        else:
            raise RuntimeError("invalid SASL state", state)
Comptaibility layer for old :class:`SASLInterface`
        implementations.

        Accepts the follwing set of :class:`SASLState` or strings and
        maps the strings to :class:`SASLState` elements as follows:

          ``"challenge"``
            :member:`SASLState.CHALLENGE`

           ``"failue"``
             :member:`SASLState.FAILURE`

           ``"success"``
             :member:`SASLState.SUCCESS`