Create a node from an appliance
967199
def add_node_from_appliance(self, appliance_id, x=0, y=0, compute_id=None):
        
        try:
            template = self.controller.appliances[appliance_id].data
        except KeyError:
            msg = "Appliance {} doesn't exist".format(appliance_id)
            log.error(msg)
            raise aiohttp.web.HTTPNotFound(text=msg)
        template["x"] = x
        template["y"] = y
        node_type = template.pop("node_type")
        compute = self.controller.get_compute(template.pop("server", compute_id))
        name = template.pop("name")
        default_name_format = template.pop("default_name_format", "{name}-{0}")
        name = default_name_format.replace("{name}", name)
        node_id = str(uuid.uuid4())
        node = yield from self.add_node(compute, name, node_id, node_type=node_type, **template)
        return node
241441
public static Node create(DbConn cnx, String nodeName, Integer port, String dlRepo, String repo, String tmpDir, String dns,
            String logLevel)
    {
        QueryResult r = cnx.runUpdate("node_insert", dlRepo, dns, true, 0, 0, false, false, true, nodeName, port, repo, logLevel, false,
                tmpDir);
        Node res = new Node();
        res.id = r.getGeneratedId();
        res.name = nodeName;
        res.dns = dns;
        res.port = port;
        res.dlRepo = dlRepo;
        res.tmpDirectory = tmpDir;
        res.repo = repo;
        res.loadApiAdmin = false;
        res.loadApiClient = false;
        res.loapApiSimple = false;
        res.enabled = true;
        res.stop = false;

        return res;
    }
458708
function createNode(src, raw, files, config) {
  var node = new FilesNode(src, raw, config);
  if (node.path || node.src) {
    files.push(node);
  }
}
702572
function builder(fromUID, node) {


		debug('builder fromUID:%s',fromUID);

		// Create a node (or use the provided one)
		var node = node || new DepNode((packageId++).toString(), options);


		// Get the entry point module object
		var fromModule = findModule(fromUID);

		// Add entry point to the module
		node.addModule(fromModule);



		debug('    fromModule.req.length:%s', fromModule.req.length);
		// For each module dependency, add module to
		// the node
		_.each(fromModule.req, function(link) {
			var module = findModule(link.uid);

			// Duplicate : pass
			if(node.hasModule(module.uid)) return;

			if(link.async) {
				debug('        Add async module (%s) to node %s', link.uid, node.id);
				// Async : Create a child node
				node.appendChild(builder(link.uid));
			} else {
				debug('        Add sync module (%s) to node %s', link.uid, node.id);
				// Sync : add module
				node.addModule(module);
				builder(link.uid, node);
			}
		});
		return node;
	}
10931
def node_from_ini(ini_file, nodefactory=Node, root_name='ini'):
    
    fileobj = open(ini_file) if isinstance(ini_file, str) else ini_file
    cfp = configparser.RawConfigParser()
    cfp.read_file(fileobj)
    root = nodefactory(root_name)
    sections = cfp.sections()
    for section in sections:
        params = dict(cfp.items(section))
        root.append(Node(section, params))
    return root
603523
def create(self):
        """"""
        required_nodes = self._get_required_nodes()
        self.lb_attrs = self.consul.create_lb(
                self.instance_name,
                protocol=self.protocol,
                port=self.port,
                nodes=required_nodes,
                node_port=str(self.backend_port),
                algorithm=getattr(self, 'algorithm', None)
                )
649644
def create_element(tag: str, name: str = None, base: type = None,
                   attr: dict = None) -> Node:
    
    from wdom.web_node import WdomElement
    from wdom.tag import Tag
    from wdom.window import customElements
    if attr is None:
        attr = {}
    if name:
        base_class = customElements.get((name, tag))
    else:
        base_class = customElements.get((tag, None))
    if base_class is None:
        attr['_registered'] = False
        base_class = base or WdomElement
    if issubclass(base_class, Tag):
        return base_class(**attr)
    return base_class(tag, **attr)
277611
def create_node(t, ref = None, debug = False):
    """"""
    if t.ttype == "operand":
        if t.tsubtype in ["range", "named_range", "pointer"] :
            # print 'Creating Node', t.tvalue, t.tsubtype
            return RangeNode(t, ref, debug = debug)
        else:
            return OperandNode(t)
    elif t.ttype == "function":
        return FunctionNode(t, ref, debug = debug)
    elif t.ttype.startswith("operator"):
        return OperatorNode(t, ref, debug = debug)
    else:
        return ASTNode(t, debug = debug)
1060927
def toDom(self, node):
        """"""
        wsdl = self.getWSDL()
        ep = ElementProxy(None, node)
        epc = ep.createAppendElement(DOM.GetWSDLUri(wsdl.version), 'part')
        epc.setAttributeNS(None, 'name', self.name)

        if self.element is not None:
            ns,name = self.element
            prefix = epc.getPrefix(ns)
            epc.setAttributeNS(None, 'element', '%s:%s'%(prefix,name))
        elif self.type is not None:
            ns,name = self.type
            prefix = epc.getPrefix(ns)
            epc.setAttributeNS(None, 'type', '%s:%s'%(prefix,name))
864294
def node_copy(node, nodefactory=Node):
    """"""
    return nodefactory(node.tag, node.attrib.copy(), node.text,
                       [node_copy(n, nodefactory) for n in node])
1011161
def get_node(name, merged=False):
    """"""
    if merged:
        node_path = os.path.join("data_bags", "node", name.replace('.', '_') + ".json")
    else:
        node_path = os.path.join("nodes", name + ".json")
    if os.path.exists(node_path):
        # Read node.json
        with open(node_path, 'r') as f:
            try:
                node = json.loads(f.read())
            except ValueError as e:
                msg = 'LittleChef found the following error in'
                msg += ' "{0}":\n                {1}'.format(node_path, str(e))
                abort(msg)
    else:
        print "Creating new node file '{0}.json'".format(name)
        node = {'run_list': []}
    # Add node name so that we can tell to which node it is
    node['name'] = name
    if not node.get('chef_environment'):
        node['chef_environment'] = '_default'
    return node
365723
function Node(options) {
  if (!(this instanceof Node))
    return new Node(options);

  AsyncObject.call(this);

  this.config = new Config('wmcc');
  this.config.inject(options);
  this.config.load(options);

  if (options.config)
    this.config.open('wmcc.conf');

  this.network = Network.get(this.config.network);
  this.startTime = -1;
  this.bound = [];
  this.plugins = Object.create(null);
  this.stack = [];

  this.logger = null;
  this.workers = null;

  this.spv = false;
  this.chain = null;
  this.fees = null;
  this.mempool = null;
  this.pool = null;
  this.miner = null;
  this.http = null;

  this.init();
}
1289695
def makeductcomponent(idf, dname):
    """"""
    aduct = idf.newidfobject("duct".upper(), Name=dname)
    aduct.Inlet_Node_Name = "%s_inlet" % (dname,)
    aduct.Outlet_Node_Name = "%s_outlet" % (dname,)
    return aduct
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)
1282447
function makeShimNode(main) {
	return {
		bundles: [main],
		dependencies: ["@loader"],
		deps: ["@loader"],
		load: {
			address: "",
			metadata: {
				format: "amd",
				deps: ["@loader"],
				dependencies: ["@loader"]
			},
			name: "@steal",
			source: `
				define("@steal", ["@loader"], function(atLoader) {
					var steal = {};

					steal.loader = atLoader;
					steal.done = function() {
						return Promise.resolve();
					};

					return steal;
				});
			`
		}
	};
}
1366855
def create_node(kwargs):
    '''
    
    '''
    if not isinstance(kwargs, dict):
        kwargs = {}

    # Required parameters
    params = {
        'Action': 'CreateInstance',
        'InstanceType': kwargs.get('size_id', ''),
        'RegionId': kwargs.get('region_id', DEFAULT_LOCATION),
        'ImageId': kwargs.get('image_id', ''),
        'SecurityGroupId': kwargs.get('securitygroup_id', ''),
        'InstanceName': kwargs.get('name', ''),
    }

    # Optional parameters'
    optional = [
        'InstanceName', 'InternetChargeType',
        'InternetMaxBandwidthIn', 'InternetMaxBandwidthOut',
        'HostName', 'Password', 'SystemDisk.Category', 'VSwitchId'
        # 'DataDisk.n.Size', 'DataDisk.n.Category', 'DataDisk.n.SnapshotId'
    ]

    for item in optional:
        if item in kwargs:
            params.update({item: kwargs[item]})

    # invoke web call
    result = query(params)
    return result['InstanceId']
255102
function createTextNode (type, item) {
      var node = parser.createTextNode(type, item.surface_form)

      if (options && options.pos) {
        node.data = item
      }

      return node
    }