Protected create vision model file
177639
protected function createVisionModelFile($database, $configs)
    {
        $tables = $this->getTableList($database);

        $database = ucfirst($database);

        foreach( $tables as $table )
        {
            (new File)->object
            (
                'model', 
                $this->getDatabaseVisionClassName($database, $table),
                [
                    'path'      => $this->getDatabaseVisionDirectory($database),
                    'namespace' => $this->getDatabaseVisionNamespace($database),
                    'use'       => ['GrandModel'],
                    'extends'   => 'GrandModel',
                    'constants' =>
                    [
                        'table'      => "'".ucfirst($table)."'",
                        'connection' => $this->stringArray($configs)
                    ]
                ]
            );
        }
    }
247668
def metamodel_from_file(file_name, **kwargs):
    
    with codecs.open(file_name, 'r', 'utf-8') as f:
        lang_desc = f.read()

    metamodel = metamodel_from_str(lang_desc=lang_desc,
                                   file_name=file_name,
                                   **kwargs)

    return metamodel
560690
def save_model(self, file_name='model.sbgn'):
        
        model = self.print_model()
        with open(file_name, 'wb') as fh:
            fh.write(model)
1250455
public static void writeGen(JavaFileObject fileObject, JsonModelModel model) throws IOException {
		Map<String, Object> map = convModelToMap(model);

		Writer writer = fileObject.openWriter();
		PrintWriter printWriter = new PrintWriter(writer);
		String generated =
				(String) TemplateRuntime.eval(getTemplateString("JsonModelGen.java.mvel"), map);
		try {
			printWriter.write(generated);
			printWriter.flush();
			printWriter.close();
		} catch (Exception e) {
			throw new RuntimeException("error raised in process " + model.getTarget(), e);
		}
	}
1283911
private void populateModel()
   {
      if (m_count != 0)
      {
         m_count = 0;
         Arrays.fill(m_flags, false);
      }

      for (Resource resource : m_parentFile.getResources())
      {
         for (int loop = 0; loop < MPXResourceField.MAX_FIELDS; loop++)
         {
            if (resource.getCachedValue(MPXResourceField.getMpxjField(loop)) != null)
            {
               if (m_flags[loop] == false)
               {
                  m_flags[loop] = true;
                  m_fields[m_count] = loop;
                  ++m_count;
               }
            }
         }
      }

      //
      // Ensure the the model fields always appear in the same order
      //
      Arrays.sort(m_fields);
      System.arraycopy(m_fields, m_fields.length - m_count, m_fields, 0, m_count);
   }
1152091
private Model makeModel() {
        Model model = new DefaultModel();
        Mapping map = model.getMapping();

        //Create 4 online nodes
        for (int i = 0; i < 4; i++) {
            Node n = model.newNode();
            nodes.add(n);
            map.addOnlineNode(n);
        }

        //Create 6 VMs: vm0..vm5
        for (int i = 0; i < 6; i++) {
            VM v = model.newVM();
            vms.add(v);
        }

        //vm2,vm1,vm0,vm3,vm5 are running on the nodes
        map.addRunningVM(vms.get(2), nodes.get(0));
        map.addRunningVM(vms.get(1), nodes.get(1));
        map.addRunningVM(vms.get(0), nodes.get(2));
        map.addRunningVM(vms.get(3), nodes.get(2));
        map.addRunningVM(vms.get(5), nodes.get(3));

        //vm4 is ready to be running on a node.
        map.addReadyVM(vms.get(4));

        //Declare a view to specify the "cpu" physical capacity of the nodes
        // and the virtual consumption of the VMs.
        //By default, nodes have 8 "cpu" resources
        ShareableResource rcCPU = new ShareableResource("cpu", 8, 0);
        rcCPU.setConsumption(vms.get(0), 2);
        rcCPU.setConsumption(vms.get(1), 3);
        rcCPU.setConsumption(vms.get(2), 4);
        rcCPU.setConsumption(vms.get(3), 3);
        rcCPU.setConsumption(vms.get(5), 5);

        //By default, nodes have 7 "mem" resources
        ShareableResource rcMem = new ShareableResource("mem", 7, 0);
        rcMem.setConsumption(vms.get(0), 2);
        rcMem.setConsumption(vms.get(1), 2);
        rcMem.setConsumption(vms.get(2), 4);
        rcMem.setConsumption(vms.get(3), 3);
        rcMem.setConsumption(vms.get(5), 4);

        //Attach the resources
        model.attach(rcCPU);
        model.attach(rcMem);
        return model;
    }
485692
def add_camera_make_model(self, make, model):
        ''' '''
        self._ef['0th'][piexif.ImageIFD.Make] = make
        self._ef['0th'][piexif.ImageIFD.Model] = model
845210
def create_model_file
      dir = "/app/models/#{@scaffold_name}.rb"
      unless File.exists?(File.join(Dir.pwd,dir))
        File.join(Dir.pwd,dir)
        source = "#{@gem_path}/lib/modules/scaffold/model.rb"
        FileUtils.cp(source,File.join(Dir.pwd,dir))
        config_model
        @valid = true
        $stdout.puts "\e[1;32m \tcreate\e[0m\t#{dir}"
      else
        $stdout.puts "\e[1;31mError:\e[0m Model named #{@scaffold_name} already exists, aborting."
      end
    end
771376
def create_cnn_model(base_arch:Callable, nc:int, cut:Union[int,Callable]=None, pretrained:bool=True,
        lin_ftrs:Optional[Collection[int]]=None, ps:Floats=0.5, custom_head:Optional[nn.Module]=None,
        split_on:Optional[SplitFuncOrIdxList]=None, bn_final:bool=False, concat_pool:bool=True):
    ""
    body = create_body(base_arch, pretrained, cut)
    if custom_head is None:
        nf = num_features_model(nn.Sequential(*body.children())) * (2 if concat_pool else 1)
        head = create_head(nf, nc, lin_ftrs, ps=ps, concat_pool=concat_pool, bn_final=bn_final)
    else: head = custom_head
    return nn.Sequential(body, head)
701042
public void writeSBGN(Model model, String file) {
		// Create the model
		Sbgn sbgn = createSBGN(model);

		// Write in file
		try {
			SbgnUtil.writeToFile(sbgn, new File(file));
		}
		catch (JAXBException e) {
			throw new RuntimeException("writeSBGN, SbgnUtil.writeToFile failed", e);
		}
	}
459467
public <T> String createForRevisions(Class<T> clazz) {
        return createForRevisions(clazz, null, null);
    }
1363201
def internal_model_from_file(
            self, file_name, encoding='utf-8', debug=None,
            pre_ref_resolution_callback=None, is_main_model=True):
        
        model = None
        callback = pre_ref_resolution_callback

        if hasattr(self, "_tx_model_repository"):
            # metamodel has a global repo
            if not callback:
                def _pre_ref_resolution_callback(other_model):
                    from textx.scoping import GlobalModelRepository
                    filename = other_model._tx_filename
                    assert filename
                    # print("METAMODEL PRE-CALLBACK{}".format(filename))
                    other_model._tx_model_repository = GlobalModelRepository(
                        self._tx_model_repository.all_models)
                    self._tx_model_repository.all_models\
                        .filename_to_model[filename] = other_model

                callback = _pre_ref_resolution_callback
            if self._tx_model_repository.all_models.has_model(file_name):
                model = self._tx_model_repository.all_models\
                    .filename_to_model[file_name]

        if not model:
            # model not present (from global repo) -> load it
            model = self._parser_blueprint.clone().get_model_from_file(
                file_name, encoding, debug=debug,
                pre_ref_resolution_callback=callback,
                is_main_model=is_main_model)

        for p in self._model_processors:
            p(model, self)
        return model
8516
function _createConfigViewOf(file, pane) {
        var result = new $.Deferred(),
            view = pane.findViewOfFile(file.fullPath);

        if (view) {
            // existing view, then just show it
            pane.showView(view);
            result.resolve(view.getFile());
        } else {
            DocumentManager.getDocumentForPath(file.fullPath)
                .done(function (doc) {
                    var view = new ConfigView(doc, pane.$el);
                    pane.addView(view, true);
                    result.resolve(doc.file);
                })
                .fail(function (fileError) {
                    result.reject(fileError);
                });
        }
        return result.promise();
    }
979444
protected function createModel()
	{
		$name = str_singular( $this->name );
		$tmpl = file_get_contents( __DIR__ . "/Model.tmpl" );
		$tmpl = str_replace( [ '{{NAME}}', '{{NAMESPACE}}' ], [ $name, $this->namespace ], $tmpl );
		$path = app_path( "Models/{$name}.php" );
		if( ! file_exists( $path ) ) {
			file_put_contents( $path, $tmpl );
		}
	}
1077740
function ViewModel(view, data, key, opts) {
	var vm = this;

	vm.view = view;
	vm.data = data;
	vm.key = key;

	if (opts) {
		vm.opts = opts;
		vm.cfg(opts);
	}

	var out = isPlainObj(view) ? view : view.call(vm, vm, data, key, opts);

	if (isFunc(out))
		{ vm.render = out; }
	else {
		vm.render = out.render;
		vm.cfg(out);
	}

	vm.init && vm.init.call(vm, vm, vm.data, vm.key, opts);
}
783020
def view_creatr(filename):
    """"""
    if not check():
        click.echo(Fore.RED + 'ERROR: Ensure you are in a bast app to run the create:view command')
        return

    path = os.path.abspath('.') + '/public/templates'
    if not os.path.exists(path):
        os.makedirs(path)

    filename_ = str(filename + ".html").lower()
    view_file = open(path + "/" + filename_, 'w+')
    view_file.write("")
    view_file.close()
    click.echo(Fore.GREEN + "View file " + filename_ + "created in public/template folder")
1142948
protected function createModelClass(\FreeFW\Model\Model &$p_model, string $p_filename)
    {
        $lines   = [];
        $lines[] = '<?php';
        $lines[] = 'namespace ' . $p_model->getMdNs() . ';';
        $lines[] = '';
        $lines[] = 'use \FreeFW\Constants as FFCST;';
        $lines[] = '';
        $lines[] = '/**';
        $lines[] = ' * ' . $p_model->getMdClass();
        $lines[] = ' *';
        $lines[] = ' * @author jeromeklam';
        $lines[] = ' */';
        $lines[] = 'class ' . $p_model->getMdClass() . ' extends \\' .
            $p_model->getMdNs() . '\\Base\\' . $p_model->getMdClass();
        $lines[] = '{';
        $lines[] = '}';
        $lines[] = '';
        file_put_contents($p_filename, implode(PHP_EOL, $lines));
        return true;
    }