Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used."""
def new_func(*args, **kwargs): message = "Call to deprecated function %s." % func.__name__ if use_instead: message += " Use %s instead." % use_instead warnings.warn(message, category=ScrapyDeprecationWarning, stacklevel=2) return func(*args, **kwargs)
"""Decorator to make sure a function always returns a deferred""" def wrapped(*a, **kw):
"""Decorator to call a function in a thread and return a deferred with the result """ @wraps(func) def wrapped(*a, **kw): return threads.deferToThread(func, *a, **kw) return wrapped |