Get another leaf node with name `val` if possible
763548
def into(self, val: str) -> Union['ApiNode', 'ApiEndpoint']:
        """"""
        if val in self.paths:
            return self.paths[val]
        if self.param:
            return self.param
        raise IndexError(_("Value {} is missing from api").format(val))
1250319
def is_leaf(obj):
    '''
        
    '''
    if(is_dict(obj)):
        length = obj.__len__()
        if(length == 0):
            return(True)
        else:
            return(False)
    else:
        return(True)
307218
async def getNodesBy(self, full, valu, cmpr='='):
        '''
        
        '''
        async for node in self.cell.getNodesBy(full, valu, cmpr=cmpr):
            yield node.pack()
1313120
def _getNodeFnib(self, name, valu):
        '''
        
        '''
        form = self.model.form(name)
        if form is None:
            raise s_exc.NoSuchForm(name=name)

        try:
            norm, info = form.type.norm(valu)
        except Exception as e:
            raise s_exc.BadPropValu(prop=form.name, valu=valu, mesg=str(e))

        buid = s_common.buid((form.name, norm))
        return form, norm, info, buid
1207094
def get(self, value, default=None):
        """"""
        path = value if isinstance(value, Path) else Path(str(value))
        subtree = self
        for part in path.parts:
            try:
                subtree = subtree[part]
            except KeyError:
                return default
        return subtree
680280
function(leafA, nextA, leafB, nextB)
{
    this.prevA = null;
    this.leafA = leafA;
    this.nextA = nextA;

    this.prevB = null;
    this.leafB = leafB;
    this.nextB = nextB;
}
995
def _parse_leaves(self, leaves) -> List[Tuple[str, int]]:
        """"""
        return [(self._leaf_name(leaf), 0) for leaf in leaves]
97492
def get_tree_type(tree):
    
    if is_leaf_node(tree):
        return SubtreeType.leaf

    tree_type = tree.label().lower().split(':')[0]
    assert tree_type in SUBTREE_TYPES
    return tree_type
800407
def leaf_list(self, node, elem, module, path):
        """"""
        nel, newm, path = self.sample_element(node, elem, module, path)
        if path is None:
            return
        minel = node.search_one("min-elements")
        self.add_copies(node, elem, nel, minel)
        self.list_comment(node, nel, minel)
1127527
def get_leaves(self):
        ""
        leaves = self._get_leaves()
        leaves.sort(key=(lambda x: x._path))  # FF sorts "mixed" last
        return leaves
1372457
def get_node_id(nuc_or_sat, namespace=None):
    """"""
    node_type = get_node_type(nuc_or_sat)
    if node_type == 'leaf':
        leaf_id = nuc_or_sat[0].leaves()[0]
        if namespace is not None:
            return '{0}:{1}'.format(namespace, leaf_id)
        else:
            return string(leaf_id)

    #else: node_type == 'span'
    span_start = nuc_or_sat[0].leaves()[0]
    span_end = nuc_or_sat[0].leaves()[1]
    if namespace is not None:
        return '{0}:span:{1}-{2}'.format(namespace, span_start, span_end)
    else:
        return 'span:{0}-{1}'.format(span_start, span_end)
886408
function(leaf){
        if(leaf==this.root){
            this.root=null;
            return;
        }
        var parent=leaf.parent;
        var sibling;
        if(parent.child1==leaf){
            sibling=parent.child2;
        }else{
            sibling=parent.child1;
        }
        if(parent==this.root){
            this.root=sibling;
            sibling.parent=null;
            return;
        }
        var grandParent=parent.parent;
        sibling.parent=grandParent;
        if(grandParent.child1==parent){
            grandParent.child1=sibling;
        }else{
            grandParent.child2=sibling;
        }
        if(this.numFreeNodes<16384){
            this.freeNodes[this.numFreeNodes++]=parent;
        }
        do{
            grandParent=this.balance(grandParent);
            this.fix(grandParent);
            grandParent=grandParent.parent;
        }while(grandParent!=null);
    }
1289925
def _leaf_list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        node = LeafListNode()
        node.type = DataType._resolve_type(
            stmt.find1("type", required=True), sctx)
        self._handle_child(node, stmt, sctx)
671492
def leaves(tree):
    
    lvs = []
    def _leaves(node):
        if np.isscalar(node):
            lvs.append(node)
        elif isinstance(node, tuple) and len(node) == 2:
            _leaves(node[0])
            _leaves(node[1])
        else:
            raise Exception("Not a tree!")

    _leaves(tree)
    return lvs
613521
def select_leaves(self, name):
        

        if self.is_leaf:
            return [self] if re.search(name, self.label) else []
        else:
            leaves = []
            if re.search(name, self.label):
                for c in self.children:
                    leaves += c._get_leaves() #all leaves
            else:
                for c in self.children:
                    leaves += c.select_leaves(name) #only matching ones
            return leaves
1168226
function findLeaf(node, offset) {
          if (offset === undef) {
            offset = node.nodeType === 3 ? node.length : node.childNodes.length;
          }

          while (node && node.hasChildNodes()) {
            node = node.childNodes[offset];
            if (node) {
              offset = node.nodeType === 3 ? node.length : node.childNodes.length;
            }
          }
          return { node: node, offset: offset };
        }
312232
function getPathValue(node, path) {
	let names = path.split("."), name;

	while ( name = names.shift() ) {
		if (node == null) {
			return names.length ? void 0 : null;
		}
		node = node[name];
	}

	return node;
}