Return a node's code
329732
def get_code(node, coder=Coder()):
    
    return cgi.escape(str(coder.code(node)), quote=True)
414181
def get_function_node(self, node):
        
        decorators = []
        for d in node.decorator_list:
            if hasattr(d, "id"):
                decorators.append(d.id)
            elif hasattr(d, "func"):
                decorators.append(d.func.id)
            elif hasattr(d, "value"):
                decorators.append(d.value.id + "." + d.attr)

        signature = get_signature(node)

        if signature is None:
            parent = self._parents[-1]
            if isinstance(parent, ClassNode) and (node.name == "__init__"):
                signature = parent.signature

        if (signature is None) and (not self.generic):
            return None

        param_names = [arg.arg if PY3 else arg.id for arg in node.args.args]
        n_args = len(param_names)

        if signature is None:
            param_types, rtype, requires = ["Any"] * n_args, "Any", {"Any"}
        else:
            _logger.debug("parsing signature for %s", node.name)
            param_types, rtype, requires = parse_signature(signature)

        # TODO: only in classes
        if ((n_args > 0) and (param_names[0] == "self")) or (
            (n_args > 0) and (param_names[0] == "cls") and ("classmethod" in decorators)
        ):
            if signature is None:
                param_types[0] = ""
            else:
                param_types.insert(0, "")

        _logger.debug("parameter types: %s", param_types)
        _logger.debug("return type: %s", rtype)
        _logger.debug("required types: %s", requires)

        self.required_types |= requires

        if node.args.vararg is not None:
            param_names.append("*" + (node.args.vararg.arg if PY3 else node.args.vararg))
            param_types.append("")

        if node.args.kwarg is not None:
            param_names.append("**" + (node.args.kwarg.arg if PY3 else node.args.kwarg))
            param_types.append("")

        kwonly_args = getattr(node.args, "kwonlyargs", [])
        if len(kwonly_args) > 0:
            param_names.extend([arg.arg for arg in kwonly_args])
            if signature is None:
                param_types.extend(["Any"] * len(kwonly_args))

        if len(param_types) != len(param_names):
            raise ValueError("Parameter names and types don't match: " + node.name)

        param_locs = [(a.lineno, a.col_offset) for a in (node.args.args + kwonly_args)]
        param_defaults = {
            bisect(param_locs, (d.lineno, d.col_offset)) - 1 for d in node.args.defaults
        }

        kwonly_defaults = getattr(node.args, "kw_defaults", [])
        for i, d in enumerate(kwonly_defaults):
            if d is not None:
                param_defaults.add(n_args + i)

        params = [
            (name, type_, i in param_defaults)
            for i, (name, type_) in enumerate(zip(param_names, param_types))
        ]

        if len(kwonly_args) > 0:
            params.insert(n_args, ("*", "", False))

        stub_node = FunctionNode(
            node.name, parameters=params, rtype=rtype, decorators=decorators
        )
        self._parents[-1].add_child(stub_node)

        self._parents.append(stub_node)
        self.generic_visit(node)
        del self._parents[-1]
        return stub_node
1104069
def emit_node(self, node):
        """"""
        emit = getattr(self, "%s_emit" % node.kind, self.default_emit)
        return emit(node)
730046
def get_code(self, code):
        
        # code= [code] if isinstance(code,str) else
        return self.new(self.data.loc[(slice(None), code), :])
1015063
def returncode(self):
        '''
        
        '''
        if not self._pop:
            self > sys.stdout
        link = self
        while link is not None:
            if link._pop:
                return link._pop.returncode
        return None
207385
async def node(self, node_id: str) -> dict:
        """"""
        return await self._request('get', node_id, base_url=NODE_URL_SCAFFOLD)
1068780
def get_matches_lineno(code, fn_name):
    ""
    class Walker(ast.NodeVisitor):
        def __init__(self):
            self._hits = set()

        #pylint: disable=E0213,E1102    
        def onvisit(fn):
            def wrap(self, node):
                fn(self,node)
                super(Walker, self).generic_visit(node)
            return wrap
        
        @onvisit
        def visit_FunctionDef(self, node):
            if node.name == fn_name:
                self._hits.add(node)
            return node
        
        @property
        def hits(self):
            return list(sorted([n.lineno + 1 for n in self._hits]))
    
    walker = Walker()
    walker.visit(ast.parse(code))
    return walker.hits
627150
def source_to_code(self, nodes, path, *, _optimize=-1):
        """"""
        if not isinstance(nodes, ast.Module):
            nodes = ast.parse(nodes, self.path)
        if self._markdown_docstring:
            nodes = update_docstring(nodes)
        return super().source_to_code(
            ast.fix_missing_locations(self.visit(nodes)), path, _optimize=_optimize
        )
575640
def node_from_nid(self, nid):
        """"""
        for node in self.iflat_nodes():
            if node.node_id == nid: return node
        raise ValueError("Cannot find node with node id: %s" % nid)
173856
def get_docstring(node):
    
    if not isinstance(node, (FunctionDef, ClassDef, Module)):
        raise TypeError("%r can't have docstrings" % node.__class__.__name__)
    if node.body and isinstance(node.body[0], Str):
        return node.body[0].s
1306113
function(node) {
      if (!node.parent) {
        return false;
      }
      return new RegExp('^(' + pragma + '\\.)?' + createClass + '$').test(sourceCode.getText(node.parent.callee));
    }
1350938
function isLastNode(node) {
            const token = sourceCode.getTokenAfter(node);

            return !token || (token.type === "Punctuator" && token.value === "}");
        }
85812
def func(self, node):
        ''
        _, params, _, _, _, expr = node
        params = map(self.eval, params)
        def func(*args):
            env = dict(self.env.items() + zip(params, args))
            return Mini(env).eval(expr)
        return func
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
73859
def get_code(self):
        """"""
        if self.code is None:
            self.code = urlopen(self.url).read()
        return self.code
1186286
def code(self):
        """"""
        code = getattr(self, '_code', None)
        if not code:
            if self.has_body():
                code = 200
            else:
                code = 204

        return code
594245
def get_node_description(self, node: BaseEntity) -> Optional[str]:
        """"""
        return self._get_node_attr(node, DESCRIPTION)