Return True if the given node is the child of a decorator
514554
def is_from_decorator(node):
    """"""
    parent = node.parent
    while parent is not None:
        if isinstance(parent, Decorators):
            return True
        parent = parent.parent
    return False
945335
def visit_decorators(self, node, parent):
        """"""
        # /!\ node is actually a _ast.FunctionDef node while
        # parent is an astroid.nodes.FunctionDef node
        newnode = nodes.Decorators(node.lineno, node.col_offset, parent)
        newnode.postinit([self.visit(child, newnode) for child in node.decorator_list])
        return newnode
161820
def _getDecoratorsName(node):
    
    # For setter properties pylint fails so we use a custom code.
    decorators = []
    if not node.decorators:
        return decorators

    for decorator in node.decorators.nodes:
        decorators.append(decorator.as_string())
    return decorators
823821
function isParenthesisOfAddition(node) {
  if (!Node.Type.isParenthesis(node)) {
    return false;
  }
  const content = node.content;
  return Node.Type.isOperator(content, '+');
}
616625
function isIllegalBareSuper(node, parent) {
  if (!t.isSuper(node)) return false;
  if (t.isMemberExpression(parent, { computed: false })) return false;
  if (t.isCallExpression(parent, { callee: node })) return false;
  return true;
}
1344853
function isCommentAtParentEnd(token, nodeType) {
            const parent = getParentNodeOfToken(token);

            return parent && isParentNodeType(parent, nodeType) &&
                    parent.loc.end.line - token.loc.end.line === 1;
        }
337044
function isParenthesisedTwice(node) {
            const previousToken = sourceCode.getTokenBefore(node, 1),
                nextToken = sourceCode.getTokenAfter(node, 1);

            return isParenthesised(node) && previousToken && nextToken &&
                astUtils.isOpeningParenToken(previousToken) && previousToken.range[1] <= node.range[0] &&
                astUtils.isClosingParenToken(nextToken) && nextToken.range[0] >= node.range[1];
        }
1367920
def _isSetter(node_type, node):
    
    if node_type not in ['function', 'method']:
        return False

    for name in _getDecoratorsName(node):
        if '.setter' in name:
            return True
    return False
614827
def is_decorated_with_property_setter(node):
    
    if not node.decorators:
        return False

    for decorator in node.decorators.nodes:
        if (
            isinstance(decorator, astroid.nodes.Attribute)
            and decorator.attrname == "setter"
        ):
            return True

    return False
33559
def visit_decorators(self, node):
        """"""
        return "@%s\n" % "\n@".join(item.accept(self) for item in node.nodes)
465822
private boolean isChild(Node cn, Node cn2) {
        if (cn == cn2)
            return false;

        Queue<Node> toProcess = new LinkedList<Node>();
        toProcess.addAll(cn.getParents());

        while (!toProcess.isEmpty()) {
            Node tcn = toProcess.poll();
            if (tcn.equals(cn2))
                return true;
            Set<Node> parents = tcn.getParents();
            if (parents != null && !parents.isEmpty())
                toProcess.addAll(parents);
        }

        return false;
    }
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})
338102
def iter_child_nodes(self, exclude=None, only=None):
        
        for field, item in self.iter_fields(exclude, only):
            if isinstance(item, list):
                for n in item:
                    if isinstance(n, Node):
                        yield n
            elif isinstance(item, Node):
                yield item
966329
def npartial(func, *args, **kwargs):
  
  def wrapped(self, node):
    func(self, *args, **kwargs)
  return wrapped
975409
def is_method_call(node, method_name):
    

    if not isinstance(node, nodes.Call):
        return False

    if isinstance(node.node, nodes.Getattr):
        # e.g. foo.bar()
        method = node.node.attr

    elif isinstance(node.node, nodes.Name):
        # e.g. bar()
        method = node.node.name

    elif isinstance(node.node, nodes.Getitem):
        # e.g. foo["bar"]()
        method = node.node.arg.value

    else:
        return False

    if isinstance(method_name, (list, tuple)):
        return method in method_name

    return method == method_name
938117
def is_flask_route_function(ast_node):
    """"""
    for decorator in ast_node.decorator_list:
        if isinstance(decorator, ast.Call):
            if _get_last_of_iterable(get_call_names(decorator.func)) == 'route':
                return True
    return False
434680
def is_decorated_with_attrs(node, decorator_names=ATTRS_NAMES):
    """"""
    if not node.decorators:
        return False
    for decorator_attribute in node.decorators.nodes:
        if isinstance(decorator_attribute, astroid.Call):  # decorator with arguments
            decorator_attribute = decorator_attribute.func
        if decorator_attribute.as_string() in decorator_names:
            return True
    return False