Skip to content

returns and raises should be converted to functions instead #1

@Martmists-GH

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

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