Create ESTree object literal node representing Unist node properties.
337418
function propsNode (node) {
  var props = flatmap(Object.keys(node), function (key) {
    if (key == 'type' || key == 'value' || key == 'children') {
      return;
    }

    var value = node[key];

    if (key == 'data') {
      value = JSON.parse(JSON.stringify(value));
    }

    return {
      type: 'Property',
      key: {
        type: 'Identifier',
        name: key
      },
      value: literalNode(value)
    };
  });

  return props.length && {
    type: 'ObjectExpression',
    properties: props
  };
}
181381
def _make_node(self, singular, plural, variables, plural_expr):
        """"""
        # singular only:
        if plural_expr is None:
            gettext = nodes.Name('gettext', 'load')
            node = nodes.Call(gettext, [nodes.Const(singular)],
                              [], None, None)

        # singular and plural
        else:
            ngettext = nodes.Name('ngettext', 'load')
            node = nodes.Call(ngettext, [
                nodes.Const(singular),
                nodes.Const(plural),
                plural_expr
            ], [], None, None)

        # mark the return value as safe if we are in an
        # environment with autoescaping turned on
        if self.environment.autoescape:
            node = nodes.MarkSafe(node)

        if variables:
            node = nodes.Mod(node, variables)
        return nodes.Output([node])
1255539
def build_subtree_strut(self, result, *args, **kwargs):
        
        items = list(result)
        root_elem = {"node": None, "children": OrderedDict()}
        if len(items) == 0:
            return root_elem
        for _, node in enumerate(items):
            new_elem = {"node": node.Resource, "children": OrderedDict()}
            path = list(map(int, node.path.split("/")))
            parent_node = root_elem
            normalized_path = path[:-1]
            if normalized_path:
                for path_part in normalized_path:
                    parent_node = parent_node["children"][path_part]
            parent_node["children"][new_elem["node"].resource_id] = new_elem
        return root_elem
653660
def make_node(cls, node, *args):
        ''' 
        '''
        if node is None:
            return cls.make_node(SymbolBOUNDLIST(), *args)

        if node.token != 'BOUNDLIST':
            return cls.make_node(None, node, *args)

        for arg in args:
            if arg is None:
                continue
            node.appendChild(arg)

        return node
173263
def as_tree(context):
    """"""

    tree = _build_tree(context, 2, 1)
    if type(tree) == dict:
        tree = [tree] 
    
    return Response(content_type='application/json', body=json.dumps(tree))
50157
function convertNode(node, nodes) {
  switch (node.type) {
    /**
     * General
     *
     * Convert simple cases that only require a type and children, with no
     * additional properties.
     */
    case 'root':
    case 'paragraph':
    case 'listItem':
    case 'blockquote':
    case 'tableRow':
    case 'tableCell': {
      return createBlock(typeMap[node.type], nodes);
    }

    /**
     * Shortcodes
     *
     * Shortcode nodes are represented as "void" blocks in the Slate AST. They
     * maintain the same data as MDAST shortcode nodes. Slate void blocks must
     * contain a blank text node.
     */
    case 'shortcode': {
      const { data } = node;
      const nodes = [createText('')];
      return createBlock(typeMap[node.type], nodes, { data, isVoid: true });
    }

    /**
     * Text
     *
     * Text and HTML nodes are both used to render text, and should be treated
     * the same. HTML is treated as text because we never want to escape or
     * encode it.
     */
    case 'text':
    case 'html': {
      return createText(node.value, node.data);
    }

    /**
     * Inline Code
     *
     * Inline code nodes from an MDAST are represented in our Slate schema as
     * text nodes with a "code" mark. We manually create the "leaf" containing
     * the inline code value and a "code" mark, and place it in an array for use
     * as a Slate text node's children array.
     */
    case 'inlineCode': {
      const leaf = {
        text: node.value,
        marks: [{ type: 'code' }],
      };
      return createText([leaf]);
    }

    /**
     * Marks
     *
     * Marks are typically decorative sub-types that apply to text nodes. In an
     * MDAST, marks are nodes that can contain other nodes. This nested
     * hierarchy has to be flattened and split into distinct text nodes with
     * their own set of marks.
     */
    case 'strong':
    case 'emphasis':
    case 'delete': {
      return convertMarkNode(node);
    }

    /**
     * Headings
     *
     * MDAST headings use a single type with a separate "depth" property to
     * indicate the heading level, while the Slate schema uses a separate node
     * type for each heading level. Here we get the proper Slate node name based
     * on the MDAST node depth.
     */
    case 'heading': {
      const depthMap = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six' };
      const slateType = `heading-${depthMap[node.depth]}`;
      return createBlock(slateType, nodes);
    }

    /**
     * Code Blocks
     *
     * MDAST code blocks are a distinct node type with a simple text value. We
     * convert that value into a nested child text node for Slate. We also carry
     * over the "lang" data property if it's defined.
     */
    case 'code': {
      const data = { lang: node.lang };
      const text = createText(node.value);
      const nodes = [text];
      return createBlock(typeMap[node.type], nodes, { data });
    }

    /**
     * Lists
     *
     * MDAST has a single list type and an "ordered" property. We derive that
     * information into the Slate schema's distinct list node types. We also
     * include the "start" property, which indicates the number an ordered list
     * starts at, if defined.
     */
    case 'list': {
      const slateType = node.ordered ? 'numbered-list' : 'bulleted-list';
      const data = { start: node.start };
      return createBlock(slateType, nodes, { data });
    }

    /**
     * Breaks
     *
     * MDAST soft break nodes represent a trailing double space or trailing
     * slash from a Markdown document. In Slate, these are simply transformed to
     * line breaks within a text node.
     */
    case 'break': {
      const textNode = createText('\n');
      return createInline('break', {}, [textNode]);
    }

    /**
     * Thematic Breaks
     *
     * Thematic breaks are void nodes in the Slate schema.
     */
    case 'thematicBreak': {
      return createBlock(typeMap[node.type], { isVoid: true });
    }

    /**
     * Links
     *
     * MDAST stores the link attributes directly on the node, while our Slate
     * schema references them in the data object.
     */
    case 'link': {
      const { title, url, data } = node;
      const newData = { ...data, title, url };
      return createInline(typeMap[node.type], { data: newData }, nodes);
    }

    /**
     * Images
     *
     * Identical to link nodes except for the lack of child nodes and addition
     * of alt attribute data MDAST stores the link attributes directly on the
     * node, while our Slate schema references them in the data object.
     */
    case 'image': {
      const { title, url, alt, data } = node;
      const newData = { ...data, title, alt, url };
      return createInline(typeMap[node.type], { isVoid: true, data: newData });
    }

    /**
     * Tables
     *
     * Tables are parsed separately because they may include an "align"
     * property, which should be passed to the Slate node.
     */
    case 'table': {
      const data = { align: node.align };
      return createBlock(typeMap[node.type], nodes, { data });
    }
  }
}
432817
def visit_expr(self, node, parent):
        """"""
        newnode = nodes.Expr(node.lineno, node.col_offset, parent)
        newnode.postinit(self.visit(node.value, newnode))
        return newnode
411
def _createunbound(kls, **info):
    """"""
    
    if issubclass(kls, Bitfield):
        nodetype = UnboundBitfieldNode
    elif hasattr(kls, '_fields_'):
        nodetype = UnboundStructureNode
    elif issubclass(kls, ctypes.Array):
        nodetype = UnboundArrayNode
    else:
        nodetype = UnboundSimpleNode        
    return nodetype(type=kls, **info)
140242
function(node) {
			var classes,
				out = [],
				obj,
				itemRootID;

			// loop roots found on one element
			classes = this.getUfClassNames(node);
			if(classes && classes.root.length && classes.root.length > 0){

				this.rootID++;
				itemRootID = this.rootID;
				obj = this.createUfObject(classes.root, classes.typeVersion);

				this.walkChildren(node, obj, classes.root, itemRootID, classes);
				if(this.impliedRules){
					this.impliedRules(node, obj, classes);
				}

				if(this.options.lang === true){
					var lang = modules.domUtils.getFirstAncestorAttribute(node, 'lang');
					if(lang){
						obj.lang = lang;
					}
				}
				out.push( this.cleanUfObject(obj) );


			}
			return out;
		}
768847
def assignment(self, node, children):
        ''
        lvalue, _, expr = children
        self.env[lvalue] = expr
        return expr
1032743
def parse_properties(node):
    
    d = dict()
    for child in node.findall('properties'):
        for subnode in child.findall('property'):
            cls = None
            try:
                if "type" in subnode.keys():
                    module = importlib.import_module('builtins')
                    cls = getattr(module, subnode.get("type"))
            except AttributeError:
                logger.info("Type [} Not a built-in type. Defaulting to string-cast.")
            d[subnode.get('name')] = cls(subnode.get('value')) if cls is not None else subnode.get('value')
    return d
597284
function TemplateLiteral(node, parent, scope, file) {
    var nodes = [];

    var _arr2 = node.quasis;
    for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
      var elem = _arr2[_i2];
      nodes.push(t.literal(elem.value.cooked));

      var expr = node.expressions.shift();
      if (expr) nodes.push(expr);
    }

    // filter out empty string literals
    nodes = nodes.filter(function (n) {
      return !t.isLiteral(n, { value: "" });
    });

    // since `+` is left-to-right associative
    // ensure the first node is a string if first/second isn't
    if (!isString(nodes[0]) && !isString(nodes[1])) {
      nodes.unshift(t.literal(""));
    }

    if (nodes.length > 1) {
      var root = buildBinaryExpression(nodes.shift(), nodes.shift());

      var _arr3 = nodes;
      for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
        var _node = _arr3[_i3];
        root = buildBinaryExpression(root, _node);
      }

      this.replaceWith(root);
      //crawl(this);
    } else {
        return nodes[0];
      }
  }
882636
def init_node(cls, *args, **kwargs):
    
    node = cls()
    for name, value in zip(cls._fields, args):
        setattr(node, name, value)
    for name, value in kwargs:
        setattr(node, name, value)
    return node
974134
def _create_type(self, env, item):
        """"""
        if item.name in env:
            existing_dt = env[item.name]
            raise InvalidSpec(
                'Symbol %s already defined (%s:%d).' %
                (quote(item.name), existing_dt._ast_node.path,
                 existing_dt._ast_node.lineno), item.lineno, item.path)
        namespace = self.api.ensure_namespace(env.namespace_name)
        if isinstance(item, AstStructDef):
            try:
                api_type = Struct(name=item.name, namespace=namespace,
                                  ast_node=item)
            except ParameterError as e:
                raise InvalidSpec(
                    'Bad declaration of %s: %s' % (quote(item.name), e.args[0]),
                    item.lineno, item.path)
        elif isinstance(item, AstUnionDef):
            api_type = Union(
                name=item.name, namespace=namespace, ast_node=item,
                closed=item.closed)
        else:
            raise AssertionError('Unknown type definition %r' % type(item))

        env[item.name] = api_type
        return api_type
684360
def visit_repr(self, node, parent):
        """"""
        newnode = nodes.Repr(node.lineno, node.col_offset, parent)
        newnode.postinit(self.visit(node.value, newnode))
        return newnode
856909
function buildTree(tokens) {
  var items = _.map(tokens, function(token) {
    return tartan.utils.node.newStripe(token);
  });
  var isReflected = (tokens.length >= 2) && (tokens[0].isPivot);
  return tartan.utils.node.newRootBlock(items, isReflected);
}
1036547
def _make_node(self, singular, plural, variables, plural_expr,
                   vars_referenced, num_called_num):
        """"""
        # no variables referenced?  no need to escape for old style
        # gettext invocations only if there are vars.
        if not vars_referenced and not self.environment.newstyle_gettext:
            singular = singular.replace('%%', '%')
            if plural:
                plural = plural.replace('%%', '%')

        # singular only:
        if plural_expr is None:
            gettext = nodes.Name('gettext', 'load')
            node = nodes.Call(gettext, [nodes.Const(singular)],
                              [], None, None)

        # singular and plural
        else:
            ngettext = nodes.Name('ngettext', 'load')
            node = nodes.Call(ngettext, [
                nodes.Const(singular),
                nodes.Const(plural),
                plural_expr
            ], [], None, None)

        # in case newstyle gettext is used, the method is powerful
        # enough to handle the variable expansion and autoescape
        # handling itself
        if self.environment.newstyle_gettext:
            for key, value in iteritems(variables):
                # the function adds that later anyways in case num was
                # called num, so just skip it.
                if num_called_num and key == 'num':
                    continue
                node.kwargs.append(nodes.Keyword(key, value))

        # otherwise do that here
        else:
            # mark the return value as safe if we are in an
            # environment with autoescaping turned on
            node = nodes.MarkSafeIfAutoescape(node)
            if variables:
                node = nodes.Mod(node, nodes.Dict([
                    nodes.Pair(nodes.Const(key), value)
                    for key, value in variables.items()
                ]))
        return nodes.Output([node])