Creates a node in the workflow for writing the veto_definer
    table. Returns a File instances for the output file.
187764
def make_veto_table(workflow, out_dir, vetodef_file=None, tags=None):
    
    if vetodef_file is None:
        vetodef_file = workflow.cp.get_opt_tags("workflow-segments",
                                           "segments-veto-definer-file", [])
        file_url = urlparse.urljoin('file:',
                                    urllib.pathname2url(vetodef_file))
        vdf_file = File(workflow.ifos, 'VETO_DEFINER',
                        workflow.analysis_time, file_url=file_url)
        vdf_file.PFN(file_url, site='local')
    else:
        vdf_file = vetodef_file

    if tags is None: tags = []
    makedir(out_dir)
    node = PlotExecutable(workflow.cp, 'page_vetotable', ifos=workflow.ifos,
                    out_dir=out_dir, tags=tags).create_node()
    node.add_input_opt('--veto-definer-file', vdf_file)
    node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file')
    workflow += node
    return node.output_files[0]
480270
private Memory createNodeMemory( MemoryFactory node,
                                     InternalWorkingMemory wm ) {
        try {
            this.lock.lock();
            // need to try again in a synchronized code block to make sure
            // it was not created yet
            Memory memory = this.memories.get( node.getMemoryId() );
            if( memory == null ) {
                memory = node.createMemory( this.kBase.getConfiguration(), wm );

                if( !this.memories.compareAndSet( node.getMemoryId(), null, memory ) ) {
                    memory = this.memories.get( node.getMemoryId() );
                }

            }
            return memory;
        } finally {
            this.lock.unlock();

        }
    }
878721
def write_conll(docgraph, output_file, coreference_layer=None,
                markable_layer=None):
    
    if markable_layer is None:
        markable_layer = docgraph.ns+':markable'
    conll_file = Conll2009File(docgraph,
                               coreference_layer=coreference_layer,
                               markable_layer=markable_layer)
    assert isinstance(output_file, (str, file))
    if isinstance(output_file, str):
        path_to_file = os.path.dirname(output_file)
        if not os.path.isdir(path_to_file):
            create_dir(path_to_file)
        conll_file.write(output_file)
    else:  # output_file is a file object
        output_file.write(conll_file.__str__())
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;
    }
485218
def generate_circle_output():
    
    base = new_base()
    workflow = networkx.DiGraph()
    LOG.info('%s python versions', len(python_versions))
    LOG.info('%s mbed cloud hosts', len(mbed_cloud_hosts))

    job, content = new_tpip()
    base['jobs'].update({job: content})
    workflow.add_node(job)

    job, content = new_newscheck()
    base['jobs'].update({job: content})
    workflow.add_node(
        job,
        workflow=dict(
            filters=dict(
                branches=dict(
                    # we ignore this check for builds directly on the base branches
                    ignore=['master', 'integration']
                )
            )
        )
    )

    job, content = new_build_documentation()
    base['jobs'].update({job: content})
    workflow.add_node(
        job,
        workflow=dict(
            requires=['build_py2', 'build_py3'],
            filters = dict(
                branches=dict(
                    # Only update the documentation on release branches
                    only=['master', 'beta']
        )
    )
    )
    )

    preload_job, content = new_preload()
    base['jobs'].update({preload_job: content})
    workflow.add_node(job)

    for py_ver in python_versions.values():
        build_job, build_content = new_build(py_ver=py_ver)
        base['jobs'].update({build_job: build_content})
        workflow.add_edge(preload_job, build_job)

        for cloud_host in mbed_cloud_hosts.values():
            test_job, test_content = new_test(py_ver=py_ver, cloud_host=cloud_host)
            base['jobs'].update({test_job: test_content})
            workflow.add_edge(build_job, test_job)

    for release_target in release_target_map.values():
        deploy_job, deploy_content = new_deploy(
            py_ver=python_versions['three'],
            release_target=release_target
        )
        base['jobs'].update({deploy_job: deploy_content})

    # wire up the release gates (clicky buttons)
    workflow.add_edge(
        test_name(python_versions['three'], mbed_cloud_hosts['osii']),
        release_name(release_target_map['beta']),
        type='approval',
    )
    workflow.add_edge(
        test_name(python_versions['three'], mbed_cloud_hosts['production']),
        release_name(release_target_map['prod']),
        type='approval',
        filters=dict(branches=dict(only='master')),
    )
    workflow.add_edge(
        test_name(python_versions['two'], mbed_cloud_hosts['production']),
        release_name(release_target_map['prod']),
    )

    # we only want to deploy in certain conditions
    workflow.add_edge(
        release_name(release_target_map['beta']),
        deploy_name(python_versions['three'], release_target_map['beta'])
    )

    workflow.add_edge(
        release_name(release_target_map['prod']),
        deploy_name(python_versions['three'], release_target_map['prod'])
    )

    workflow_jobs = base['workflows']['python_sdk_workflow']['jobs']

    # build the workflow graph
    for job_name in networkx.topological_sort(workflow):
        job_config = {}
        per_node_config = workflow.nodes[job_name].get('workflow')
        if per_node_config:
            job_config.update(per_node_config)
        workflow_jobs.append({job_name: job_config})
        for edge in workflow.in_edges(job_name):
            job_config.update(workflow.get_edge_data(*edge))
            job_config.setdefault('requires', []).append(edge[0])

    LOG.info('%s circle jobs', len(base['jobs']))
    return dict(base)
394681
def _create_table_xml_file(self, data, fname=None):
        
        content = self._xml_pretty_print(data)
        if not fname:
            fname = self.name
        with open(fname+".xml", 'w') as f:
            f.write(content)
1082589
def create(self):
        
        data = self._node_data()
        data["node_id"] = self._id
        if self._node_type == "docker":
            timeout = None
        else:
            timeout = 1200
        trial = 0
        while trial != 6:
            try:
                response = yield from self._compute.post("/projects/{}/{}/nodes".format(self._project.id, self._node_type), data=data, timeout=timeout)
            except ComputeConflict as e:
                if e.response.get("exception") == "ImageMissingError":
                    res = yield from self._upload_missing_image(self._node_type, e.response["image"])
                    if not res:
                        raise e
                else:
                    raise e
            else:
                yield from self.parse_node_response(response.json)
                return True
            trial += 1
1323757
def create_package_node(self, team, user, package, dry_run=False):
        
        contents = RootNode(dict())
        if dry_run:
            return contents

        self.check_name(team, user, package)
        assert contents is not None
        self.create_dirs()

        # Delete any existing data.
        path = self.package_path(team, user, package)
        try:
            os.remove(path)
        except OSError:
            pass

        return contents
831141
def create_header
      nodes = {
        deploymentStatus: 'Deployed',
        description: "A custom object named #{@name}",
        enableActivities: 'true',
        enableFeeds: 'false',
        enableHistory: 'true',
        enableReports: 'true'
      }
      make_nodes(nodes, @doc_root)
    end
604917
def add_node(self, node):
        
        new = ClusterNode.from_uri(node["addr"])
        cluster_member = self.nodes[0]
        check_new_nodes([new], [cluster_member])

        new.meet(cluster_member.host, cluster_member.port)
        self.nodes.append(new)

        self.wait()

        if node["role"] != "slave":
            return

        if "master" in node:
            target = self.get_node(node["master"])
            if not target:
                raise NodeNotFound(node["master"])
        else:
            masters = sorted(self.masters, key=lambda x: len(x.slaves(x.name)))
            target = masters[0]

        new.replicate(target.name)
        new.flush_cache()
        target.flush_cache()
566792
def _create_xml_node(cls):
        
        try:
            xml_map = cls._xml_map
        except AttributeError:
            raise ValueError("This model has no XML definition")

        return _create_xml_node(
            xml_map.get('name', cls.__name__),
            xml_map.get("prefix", None),
            xml_map.get("ns", None)
        )
708545
public Node createProxyNode(Object sourceNodeId, Object targetNodeId, GraphDatabaseService graphDb,
            EntityMetadata sourceEntityMetadata, EntityMetadata targetEntityMetadata)
    {

        String sourceNodeIdColumnName = ((AbstractAttribute) sourceEntityMetadata.getIdAttribute()).getJPAColumnName();
        String targetNodeIdColumnName = ((AbstractAttribute) targetEntityMetadata.getIdAttribute()).getJPAColumnName();

        Node node = graphDb.createNode();
        node.setProperty(PROXY_NODE_TYPE_KEY, PROXY_NODE_VALUE);
        node.setProperty(sourceNodeIdColumnName, sourceNodeId);
        node.setProperty(targetNodeIdColumnName, targetNodeId);
        return node;
    }
1065423
private void createEdge(Node fromNode, ControlFlowGraph.Branch branch,
      Node toNode) {
    cfg.createNode(fromNode);
    cfg.createNode(toNode);
    cfg.connectIfNotFound(fromNode, branch, toNode);
  }
991829
def create(output_prefix, grid_flux_filename, wavelength_filenames,
    clobber=False, grid_flux_filename_format="csv", **kwargs):
    

    if not clobber:
        # Check to make sure the output files won't exist already.
        output_suffixes = (".yaml", ".pkl", "-wavelengths.memmap",
            "-intensities.memmap")
        for path in [output_prefix + suffix for suffix in output_suffixes]:
            if os.path.exists(path):
                raise IOError("output filename {} already exists".format(path))

    # Read the grid_flux filename.
    # param1 param2 param3 param4 channelname1 channelname2
    kwds = kwargs.pop("__grid_flux_filename_kwargs", {})
    kwds.update({"format": grid_flux_filename_format})
    grid_flux_tbl = Table.read(grid_flux_filename, **kwds)

    # Distinguish column names between parameters (real numbers) and filenames
    str_columns = \
        np.array([_[1].startswith("|S") for _ in grid_flux_tbl.dtype.descr])

    # Check the number of channels provided.
    if str_columns.sum() != len(wavelength_filenames):
        raise ValueError("expected {0} wavelength filenames because {1} has {0}"
            " string columns ({2}) but found {3} wavelength filenames".format(
                sum(str_columns), grid_flux_filename, 
                ", ".join(np.array(grid_flux_tbl.colnames)[str_columns]), 
                len(wavelength_filenames)))

    # Create a record array of the grid points.
    grid_points = \
        grid_flux_tbl.as_array()[np.array(grid_flux_tbl.colnames)[~str_columns]]

    # To-do: make sure they are all floats.

    # Sort the grid points.
    grid_indices = grid_points.argsort(order=grid_points.dtype.names)
    grid_points = grid_points[grid_indices]
    grid_flux_tbl = grid_flux_tbl[grid_indices]

    # Check the wavelength filenames.
    channel_wavelengths = np.array(map(load_simple_data, wavelength_filenames))

    # Sort the channels by starting wavelength.
    c_indices = np.argsort([each.min() for each in channel_wavelengths])
    channel_names = np.array(grid_flux_tbl.colnames)[str_columns][c_indices]
    channel_wavelengths = channel_wavelengths[c_indices]
    channel_sizes = [len(_) for _ in channel_wavelengths]
    num_pixels = sum(channel_sizes)

    # Create the model YAML file.
    with open(output_prefix + ".yaml", "w") as fp:
        header = "\n".join([
            "# Model created on {0}".format(strftime("%Y-%m-%d %H:%M:%S")),
            "# Grid parameters: {0}".format(", ".join(grid_points.dtype.names)),
            "# Channel names: {0}".format(", ".join(channel_names))
            ])
        fp.write(header + "\n" + yaml.safe_dump({ "model_grid": {
                "grid_points": output_prefix + ".pkl",
                "intensities": output_prefix + "-intensities.memmap",
                "wavelengths": output_prefix + "-wavelengths.memmap"
            }}, stream=None, allow_unicode=True, default_flow_style=False))

    # Create the pickled model file, with meta data.
    metadata = {
        "grid_flux_filename": grid_flux_filename,
        "wavelength_filenames": wavelength_filenames,
        "channel_names": channel_names,
        "channel_sizes": channel_sizes,
        "channel_resolutions": [float("inf")] * len(channel_names),
        "sick_version": sick_version
    }
    logger.debug("Dumping grid points and metadata to file")
    with open(output_prefix + ".pkl", "wb") as fp:
        pickle.dump((grid_points, metadata), fp, -1)

    # Create the memory-mapped dispersion file.
    logger.debug("Creating memory-mapped dispersion file.")
    wavelengths_memmap = np.memmap(output_prefix + "-wavelengths.memmap",
        dtype="float32", mode="w+", shape=(num_pixels, ))
    wavelengths_memmap[:] = np.hstack(channel_wavelengths)
    wavelengths_memmap.flush()
    del wavelengths_memmap

    # Create the memory-mapped intensities file.
    logger.debug("Creating memory-mapped intensities file.")
    intensities_memmap = np.memmap(output_prefix + "-intensities.memmap",
        shape=(grid_points.size, num_pixels), dtype="float32",
        mode="w+")
    
    n = len(grid_flux_tbl)
    for i, row in enumerate(grid_flux_tbl):
        logger.debug("Loading point {0}/{1} into the intensities map"\
            .format(i + 1, n))
        j = 0
        for channel_name in channel_names:
            try:
                data = load_simple_data(row[channel_name])
            except:
                logger.exception("Could not load data from {0} for channel {1}"\
                    .format(row[channel_name], channel_name))
                raise
            intensities_memmap[i, j:j + data.size] = data
            j += data.size

    intensities_memmap.flush()
    del intensities_memmap

    return True
383743
def add_new_file(self, node):
        

        if self.__script_editor.model.is_authoring_node(node):
            return self.__script_editor.new_file()

        file, state = QInputDialog.getText(self, "Add File", "Enter your new file name:")
        if not state:
            return False

        if node.family in ("Project", "Directory"):
            directory = node.path
        elif node.family == "File":
            directory = os.path.dirname(node.path)

        # file = foundations.strings.to_string(file)
        if not file in os.listdir(directory):
            file = os.path.join(directory, file)
            LOGGER.info("{0} | Adding '{1}' file!".format(self.__class__.__name__, file))
            open(file, "w").close()
        else:
            self.__raise_file_system_exception(file, directory)
        return True
239671
def newDocFragment(self):
        
        ret = libxml2mod.xmlNewDocFragment(self._o)
        if ret is None:raise treeError('xmlNewDocFragment() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
330747
public Flow<JobXMLDescriptor> getOrCreateFlow()
   {
      List<Node> nodeList = model.get("flow");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new FlowImpl<JobXMLDescriptor>(this, "flow", model, nodeList.get(0));
      }
      return createFlow();
   }