Returns a partial node visitor function
966329
def npartial(func, *args, **kwargs):
  
  def wrapped(self, node):
    func(self, *args, **kwargs)
  return wrapped
729118
def visit_keyword(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        arg = node.arg
        if arg is None:
            return f"**{self.visit(node.value)}"
        else:
            return f"{arg}={self.visit(node.value)}"
1353842
public ClassNode visitPublicNotAbstractTreeNodes($.Visitor<ClassNode> visitor) {
        return visitTree($.guardedVisitor(new $.Predicate<ClassNode>() {
            @Override
            public boolean test(ClassNode classNode) {
                return classNode.publicNotAbstract();
            }
        }, visitor));
    }
1021120
function partial( fn, j ) {
	return function accessor( d, i ) {
		return fn( d, i, j );
	};
}
1313766
def get_visit_fn(cls, kind, is_leaving=False) -> Callable:
        """"""
        method = "leave" if is_leaving else "enter"
        visit_fn = getattr(cls, f"{method}_{kind}", None)
        if not visit_fn:
            visit_fn = getattr(cls, method, None)
        return visit_fn
293481
function visitor(parent) {
    var index = -1
    var children = parent && parent.children

    if (!children) {
      throw new Error('Missing children in `parent` for `visitor`')
    }

    while (++index in children) {
      callback(children[index], index, parent)
    }
  }
152483
function getPartial(fs, path, callback) {
  getAttr(fs, path, constants.attributes.partial, callback);
}
996707
def visit_RETURN(self, node):
        
        if len(node.children) == 2:
            node.children[1] = (yield ToVisit(node.children[1]))
        yield node
767381
function traverseRevTree(revs, callback) {
  var toVisit = revs.slice();

  var node;
  while ((node = toVisit.pop())) {
    var pos = node.pos;
    var tree = node.ids;
    var branches = tree[2];
    var newCtx =
      callback(branches.length === 0, pos, tree[0], node.ctx, tree[1]);
    for (var i = 0, len = branches.length; i < len; i++) {
      toVisit.push({pos: pos + 1, ids: branches[i], ctx: newCtx});
    }
  }
}
263528
def _visit_for(self, cls, node, parent):
        """"""
        newnode = cls(node.lineno, node.col_offset, parent)
        type_annotation = self.check_type_comment(node)
        newnode.postinit(
            target=self.visit(node.target, newnode),
            iter=self.visit(node.iter, newnode),
            body=[self.visit(child, newnode) for child in node.body],
            orelse=[self.visit(child, newnode) for child in node.orelse],
            type_annotation=type_annotation,
        )
        return newnode
772322
function createPartialTree (currentFile, partials, visitedFiles) {
  if (visitedFiles[currentFile.name]) {
    return {
      label: '*' + currentFile.name + '*',
      name: currentFile.name
    }
  }
  visitedFiles[currentFile.name] = true

  var result = {
    label: currentFile.name,
    name: currentFile.name,
    summary: _.trunc(chainOrUndefined(currentFile, 'apidocs', 0, 'parsed', 'description'), {
      separator: ' ',
      length: 50
    })
  }
  if (currentFile.children.length > 0) {
    _.merge(result, {
      children: currentFile.children.map(function (child) {
        return createPartialTree(partials[child], partials, visitedFiles)
      })
    })
  }
  return result
}
42048
public ClassNode visitPublicNotAbstractSubTreeNodes($.Visitor<ClassNode> visitor) {
        return visitSubTree($.guardedVisitor(new $.Predicate<ClassNode>() {
            @Override
            public boolean test(ClassNode classNode) {
                return classNode.publicNotAbstract();
            }
        }, visitor));
    }
1109411
function visitor(node, index, parent) {
    if (parent && queue.indexOf(parent) === -1) {
      queue.push(parent)
      one(parent)
    }
  }
274637
function traverseAst(sourceCode, node, parent, visitor) {
    if (visitor[node.type]) {
        visitor[node.type](node, parent)
    }

    const keys = sourceCode.visitorKeys[node.type]
    for (const key of keys) {
        const child = node[key]

        if (Array.isArray(child)) {
            for (const c of child) {
                if (c) {
                    traverseAst(sourceCode, c, node, visitor)
                }
            }
        } else if (child) {
            traverseAst(sourceCode, child, node, visitor)
        }
    }
}
672842
def get_nodes(code, desired_type, path="__main__", mode="exec", tree=None):
    
    return _GetVisitor(parse(code, path, mode, tree), desired_type).result
740530
def _bfs(node, visited):
    """"""
    queue = collections.deque()
    queue.appendleft(node)
    while queue:
        node = queue.pop()
        if node not in visited:
            if node.lo is not None:
                queue.appendleft(node.lo)
            if node.hi is not None:
                queue.appendleft(node.hi)
            visited.add(node)
            yield node
520027
def visit(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        # print(node.__class__.__name__)
        if node is None:
            return ''
        if isinstance(node, ast.Expression):
            return self.visit(node.body)
        # dispatch to specific or generic method
        method = 'visit_' + node.__class__.__name__
        visitor = getattr(self, method, self.generic_visit)
        return visitor(node, dfltChaining)