Helper to check if func is wraped by our deprecated decorator
503642
def _is_deprecated(func):
    """"""
    if sys.version_info < (3, 5):
        raise NotImplementedError("This is only available for python3.5 "
                                  "or above")
    closures = getattr(func, '__closure__', [])
    if closures is None:
        closures = []
    is_deprecated = ('deprecated' in ''.join([c.cell_contents
                                              for c in closures
                                              if isinstance(c.cell_contents, str)]))
    return is_deprecated
1203598
def undecorate(func):
    """"""
    orig_call_wrapper = lambda x: x
    for call_wrapper, unwrap in SUPPORTED_DECORATOR.items():
        if isinstance(func, call_wrapper):
            func = unwrap(func)
            orig_call_wrapper = call_wrapper
            break
    return orig_call_wrapper, func
443368
def deprecated(func):
    """"""
    def newFunc(*args, **kwargs):
        print("Call to deprecated function %s." % func.__name__)
        return func(*args, **kwargs)
    newFunc.__name__ = func.__name__
    newFunc.__doc__ = func.__doc__
    newFunc.__dict__.update(func.__dict__)
    return newFunc
446816
function checkDecorator(decorator, value, node) {
      const decoratorLine = decorator.loc.start.line;
      const decoratorColumn = decorator.loc.end.column;
      const valueLine = value.loc.start.line;

      if (config === 'always') {
        if (decoratorLine === valueLine) {
          context.report({
            node,
            loc: { line: decoratorLine, column: decoratorColumn },
            message: ALWAYS_MESSAGE,
          });
        }
      } else {
        if (decoratorLine !== valueLine) { // eslint-disable-line
          context.report({
            node,
            loc: { line: decoratorLine, column: decoratorColumn },
            message: NEVER_MESSAGE,
          });
        }
      }
    }
901913
def deprecated(func):
    
    @functools.wraps(func)
    def new_func(*args, **kwargs):
        if sys.version_info < (3, 0):
            warnings.warn_explicit(
                "Call to deprecated function {}.".format(func.__name__),
                category=DeprecationWarning,
                filename=func.func_code.co_filename,
                lineno=func.func_code.co_firstlineno + 1
            )
        else:
            warnings.warn_explicit(
                "Call to deprecated function {}.".format(func.__name__),
                category=DeprecationWarning,
                filename=func.__code__.co_filename,
                lineno=func.__code__.co_firstlineno + 1
            )
        return func(*args, **kwargs)
    return new_func
121314
def check_contract_allowed(func):
    
    @wraps(func)
    def decorator(*args, **kwargs):
        contract = kwargs.get('contract')
        if (contract and current_user.is_authenticated()
                and not current_user.allowed(contract)):
            return current_app.login_manager.unauthorized()
        return func(*args, **kwargs)
    return decorator
1103644
def trace_decorator(self):
        """"""

        def decorator(func):

            def wrapper(*args, **kwargs):
                self.tracer.start_span(name=func.__name__)
                return_value = func(*args, **kwargs)
                self.tracer.end_span()
                return return_value

            return wrapper

        return decorator
412257
def deprecated(message, stacklevel=2):  # pragma: no cover
    

    def _decorator(func):
        @wraps(func)
        def _func(*args, **kwargs):
            warnings.warn(
                "'{}' is deprecated. {}".format(func.__name__, message),
                category=DeprecationWarning,
                stacklevel=stacklevel
            )
            return func(*args, **kwargs)
        return _func
    return _decorator
939951
def deprecated(instructions):
    
    def decorator(func):
        """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.
        """
        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            message = 'Call to deprecated function {}. {}'.format(func.__name__,
                                                                  instructions)
            frame = inspect.currentframe().f_back
            warnings.warn_explicit(message,
                                   category=DeprecatedWarning,
                                   filename=inspect.getfile(frame.f_code),
                                   lineno=frame.f_lineno)
            return func(*args, **kwargs)
        return wrapper
    return decorator
935654
def initialized(func):
    

    def wrapper(self, *args, **kwargs):
        """ internal wrapper function """
        if not self.__is_initialized__:
            return EmptyDot()
        return func(self, *args, **kwargs)
    return wrapper
871637
def call(self, func, *args, **kwargs):
        
        wrapped = self.wrap(func)
        return wrapped(*args, **kwargs)
64157
def deprecated(message):  # pragma: no cover
    

    def deprecated_decorator(func):
        """Deprecation decorator."""

        @wraps(func)
        def deprecated_func(*args, **kwargs):
            """Display deprecation warning."""

            warnings.warn(
                "'{}' is deprecated. {}".format(func.__name__, message),
                category=DeprecationWarning,
                stacklevel=2
            )
            return func(*args, **kwargs)
        return deprecated_func
    return deprecated_decorator
895878
def is_void(func):
    
    try:
        source = dedent(inspect.getsource(func))
    except (OSError, IOError):
        return False
    fdef = next(ast.iter_child_nodes(ast.parse(source)))
    return (
      type(fdef) is ast.FunctionDef and len(fdef.body) == 1 and
      type(fdef.body[0]) is ast.Expr and
      type(fdef.body[0].value) in {ast.Str, ast.Ellipsis})
316536
def check_is_table(func):
    
    @wraps(func)
    def wrapper(**kwargs):
        if not orca.is_table(kwargs['table_name']):
            abort(404)
        return func(**kwargs)
    return wrapper
1231387
def _wrap_deprecated_function(func, message):
    
    def _(col):
        warnings.warn(message, DeprecationWarning)
        return func(col)
    return functools.wraps(func)(_)
950502
def decorator(f):
    """"""
    @functools.wraps(f)
    def decoratored_function(*args, **kwargs):
        if args and len(args) == 1:
            return f(*args, **kwargs)

        if args:
            raise TypeError(
                "This decorator only accepts extra keyword arguments.")

        return lambda g: f(g, **kwargs)

    return decoratored_function
268787
def no_type_check_decorator(decorator):
    

    @functools.wraps(decorator)
    def wrapped_decorator(*args, **kwds):
        func = decorator(*args, **kwds)
        func = no_type_check(func)
        return func

    return wrapped_decorator