Return a single Node by (form,valu) tuple.

        Args:
            ndef ((str,obj)): A (form,valu) ndef tuple.  valu must be
            normalized.

        Returns:
            (synapse.lib.node.Node): The Node or None.
555148
async def getNodeByNdef(self, ndef):
        '''
        
        '''
        buid = s_common.buid(ndef)
        return await self.getNodeByBuid(buid)
642668
def ndef(self):
        """"""
        if self._ndef is None:
            ndef = self.NDEF(self)
            if ndef.has_changed:
                self._ndef = ndef
        return self._ndef
1322187
def element(cls, name, parent=None, interleave=None, occur=0):
        """"""
        node = cls("element", parent, interleave=interleave)
        node.attr["name"] = name
        node.occur = occur
        return node
1182430
def setnodeval(delta, graph, node, key, value):
    """"""
    if (
        graph in delta and 'nodes' in delta[graph] and
        node in delta[graph]['nodes'] and not delta[graph]['nodes'][node]
    ):
        return
    delta.setdefault(graph, {}).setdefault('node_val', {}).setdefault(node, {})[key] = value
1255808
def node(self, name, label=None, _attributes=None, **attrs):
        
        name = self._quote(name)
        attr_list = self._attr_list(label, attrs, _attributes)
        line = self._node % (name, attr_list)
        self.body.append(line)
717350
def t(root, children=None, debug=False, root_id=None):
    ""
    if isinstance(root, Tree):
        if children is None:
            return root
        return root.__class__(root, children, root_id)

    elif isinstance(root, basestring):
        root = debug_root_label(root, debug, root_id)

        # Beware: (DGParented)Tree is a subclass of list!
        if isinstance(children, Tree):
            child_trees = [children]

        elif isinstance(children, list):
            child_trees = []
            for child in children:
                if isinstance(child, Tree):
                    child_trees.append(child)
                elif isinstance(child, list):
                    child_trees.extend(child)
                elif isinstance(child, tuple):
                    child_trees.append(t(*child))
                elif isinstance(child, basestring):
                    child_trees.append(child)
                else:
                    raise NotImplementedError

        elif isinstance(children, basestring):
            # this tree does only have one child, a leaf node
            # TODO: this is a workaround for the following problem:
            # Tree('foo', [Tree('bar', [])]) != Tree('foo', ['bar'])
            child_trees = [Tree(children, [])]

        else:
            # this tree only consists of one leaf node
            assert children is None
            child_trees = []

        return DGParentedTree(root, child_trees, root_id)

    else:
        raise NotImplementedError
1369039
def to_nnf(self):
        """"""
        node = self.node.to_nnf()
        if node is self.node:
            return self
        else:
            return _expr(node)
832809
def get_member_node(self, key):
    """"""
    for tup, _ in self.lookups:
      if key in tup:
        return tup.get_member_node(key)
    raise RuntimeError('Key not found in composite tuple: %r' % key)
715419
def dnode(self, node):
        """"""
        new_node = copy(node)
        new_node.lineno += self.dline
        new_node.col_offset += self.dcol
        return new_node
331011
def node(self):
        

        if self.node_class is None:
            raise ValueError("You have to create an ``Item`` by calling ``__init__`` with ``node_class`` argument"
                             " or by decorating a ``Node`` class.")

        node = self.node_class(*self.node_args, **self.node_kwargs)
        node.__item__ = self

        return node
201370
def format_nd_slice(item, ndim):
    
    if not isinstance(item, tuple):
        item = (item,)
    return item[:ndim] + (None,) * (ndim - len(item))
708459
def convert_l2normalization(node, **kwargs):
    
    name, input_nodes, attrs = get_inputs(node, kwargs)

    mode = attrs.get("mode", "instance")

    if mode != "channel":
        raise AttributeError("L2Normalization: ONNX currently supports channel mode only")

    l2norm_node = onnx.helper.make_node(
        "LpNormalization",
        input_nodes,
        [name],
        axis=1,  # channel only
        name=name
    )
    return [l2norm_node]
983634
def get_sequence_value(node):
        
        assert node.Datatype == 15
        data = defaultdict(list)
        cols = []
        for i in range(node.NumValues):
            row = node.GetValue(i)
            if i == 0:  # Get the ordered cols and assume they are constant
                cols = [str(row.GetElement(_).Name) for _ in range(row.NumElements)]

            for cidx in range(row.NumElements):
                col = row.GetElement(cidx)
                data[str(col.Name)].append(XmlHelper.as_value(col))
        return DataFrame(data, columns=cols)
813776
function getDelim() {
  const type = NodeType.DelimType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = ',';

  pos++;

  return newNode(type, content, line, column);
}
202855
public org.tensorflow.framework.CostGraphDef.NodeOrBuilder getNodeOrBuilder(
      int index) {
    return node_.get(index);
  }
266065
def make_node(cls, id_, arglist, lineno):
        
        assert isinstance(arglist, SymbolARGLIST)
        variable = gl.SYMBOL_TABLE.access_array(id_, lineno)
        if variable is None:
            return None

        if len(variable.bounds) != len(arglist):
            syntax_error(lineno, "Array '%s' has %i dimensions, not %i" %
                         (variable.name, len(variable.bounds), len(arglist)))
            return None

        # Checks for array subscript range if the subscript is constant
        # e.g. A(1) is a constant subscript access
        for i, b in zip(arglist, variable.bounds):
            btype = gl.SYMBOL_TABLE.basic_types[gl.BOUND_TYPE]
            lower_bound = NUMBER(b.lower, type_=btype, lineno=lineno)
            i.value = BINARY.make_node('MINUS',
                                       TYPECAST.make_node(btype, i.value, lineno),
                                       lower_bound, lineno, func=lambda x, y: x - y,
                                       type_=btype)
            if is_number(i.value) or is_const(i.value):
                val = i.value.value
                if val < 0 or val > b.count:
                    warning(lineno, "Array '%s' subscript out of range" % id_)

        # Returns the variable entry and the node
        return cls(variable, arglist, lineno)
361160
def _normalize_branch_node(self, node):
        # sys.stderr.write('nbn\n')
        
        not_blank_items_count = sum(1 for x in range(17) if node[x])
        assert not_blank_items_count >= 1

        if not_blank_items_count > 1:
            self._encode_node(node)
            return node

        # now only one item is not blank
        not_blank_index = [i for i, item in enumerate(node) if item][0]

        # the value item is not blank
        if not_blank_index == 16:
            o = [pack_nibbles(with_terminator([])), node[16]]
            self._encode_node(o)
            return o

        # normal item is not blank
        sub_node = self._decode_to_node(node[not_blank_index])
        sub_node_type = self._get_node_type(sub_node)

        if is_key_value_type(sub_node_type):
            # collape subnode to this node, not this node will have same
            # terminator with the new sub node, and value does not change
            self._delete_node_storage(sub_node)
            new_key = [not_blank_index] + \
                unpack_to_nibbles(sub_node[0])
            o = [pack_nibbles(new_key), sub_node[1]]
            self._encode_node(o)
            return o
        if sub_node_type == NODE_TYPE_BRANCH:
            o = [pack_nibbles([not_blank_index]),
                 node[not_blank_index]]
            self._encode_node(o)
            return o
        assert False