Skip to content

returns and raises should be converted to functions instead #1

Description

@Martmists-GH
def returns(expression):
    """
    Return action for the :class:`intercept` decorator.
    """
    def inner(exception):
        if callable(expression):
            return expression(exception)
        return expression
    return inner


def raises(expression):
    """
    Raise action for the :class:`intercept` decorator.
    """
    def inner(exception):
        if callable(expression):
            raise expression(exception)
        raise expression
    return inner

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions