Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)
I return a generator decorator wrapping all exceptions as `extype`.
    

        def wrap_generator_exceptions(extype):
    """I return a generator decorator wrapping all exceptions as `extype`.
    """
    assert issubclass(extype, BaseException), \
        "Did you write @wrap_exception instead of @wrap_exception(extype)?"
    def wrap_generator_exceptions_decorator(func):
        """The decorator returned by wrap_generator_exceptions"""
        @wraps(func)
        def wrapped(*args, **kw):
            """The decorated function"""
            try:
                for i in func(*args, **kw):
                    yield i
            except BaseException, ex:
                raise extype(ex)
        return wrapped
    return wrap_generator_exceptions_decorator
        


src/k/t/kTBS-0.2/lib/rdfrest/serializers.py   kTBS(Download)
from .parsers import _FormatRegistry
from .serializers_html import serialize_htmlized_turtle
from .utils import coerce_to_uri, wrap_generator_exceptions
 
################################################################

src/k/t/ktbs-HEAD/lib/rdfrest/serializers.py   ktbs(Download)
from .parsers import _FormatRegistry
from .serializers_html import serialize_htmlized_turtle
from .utils import coerce_to_uri, wrap_generator_exceptions
 
################################################################