Create a new notebook and return its model with no content.
490073
def create_notebook(self, model=None, path=''):
        """"""
        path = path.strip('/')
        if model is None:
            model = {}
        if 'content' not in model:
            metadata = current.new_metadata(name=u'')
            model['content'] = current.new_notebook(metadata=metadata)
        if 'name' not in model:
            model['name'] = self.increment_filename('Untitled', path)

        model['path'] = path
        model['type'] = 'notebook'
        model = self.save_notebook(model, model['name'], model['path'])

        return model
1223711
def create_model_table(self, model):
        
        try:
            return db_model_factory(self.Base, model, self.models)
        except Exception as exc:
            raise ModelError(
                model.name,
                message="failed to create in-memory table.",
                orig_exc=exc,
                context=self.error_context
            )
1357373
def _create_model(self, view_getter=None, source_getters=None,
                      model_factory=None, officer=None):
        

        if view_getter is not None:
            d = defer.succeed(view_getter)
            d.addCallback(self._retrieve_view)
            d.addCallback(self._check_view)
        else:
            # views are inherited
            d = defer.succeed(self.model.view)

        d.addCallback(self._retrieve_model, source_getters,
                      model_factory, officer)

        d.addErrback(self._filter_errors)
        return d
226122
def initialize_notebook():
    """"""
    try:
        from IPython.core.display import display, HTML
    except ImportError:
        print("IPython Notebook could not be loaded.")

    lib_js = ENV.get_template('ipynb_init_js.html')
    lib_css = ENV.get_template('ipynb_init_css.html')

    display(HTML(lib_js.render()))
    display(HTML(lib_css.render()))
116030
def new(self, *args, **kwargs):
        '''
'''
        return self.session().add(self.model(*args, **kwargs))
1084271
def create(data=None, id=None, message=None):
        

        return Error(
            data=data,
            id=id,
            message=message,
        )
280188
def create(backbone: ModelFactory, vmin: float, vmax: float, atoms: int,
           input_block: typing.Optional[ModelFactory]=None):
    
    if input_block is None:
        input_block = IdentityFactory()

    return QDistributionalModelFactory(
        input_block=input_block, backbone=backbone,
        vmin=vmin,
        vmax=vmax,
        atoms=atoms
    )
379843
def create_named_notebook(fname, context):
    """"""

    if os.path.exists(fname):
        return

    from nbformat import v4 as nbf

    # Courtesy of http://nbviewer.ipython.org/gist/fperez/9716279
    text = "Welcome to *pyramid_notebook!* Use *File* *>* *Shutdown* to close this."
    cells = [nbf.new_markdown_cell(text)]

    greeting = context.get("greeting")
    if greeting:
        cells.append(nbf.new_markdown_cell(greeting))

    cells.append(nbf.new_code_cell(''))

    nb = nbf.new_notebook(cells=cells)

    with open(fname, 'w') as f:
        writer = JSONWriter()
        writer.write(nb, f)
387101
def create(cls, data, **kwargs):
        """"""
        with db.session.begin_nested():
            model = cls.dbmodel(**kwargs)
            model.data = data
            obj = cls(model)
            db.session.add(obj.model)
        return obj
732854
def create(self, **kwargs):
        
        model = self.new(**kwargs)
        return self.save(model)
1066614
def create(input_length, hidden_layers, activation='tanh', normalization=None):
    
    def instantiate(**_):
        return MLP(
            input_length=input_length,
            hidden_layers=hidden_layers,
            activation=activation,
            normalization=normalization
        )

    return ModelFactory.generic(instantiate)
1214385
def create
      return unless new_record?

      parent_machine.with_open_session do |session|
        machine = session.machine
        machine.create_shared_folder(name, host_path, writable)
      end

      existing_record!
      clear_dirty!
    end
578223
def create_object(
        request, model=None, template_name=None,
        template_loader=loader, extra_context=None, post_save_redirect=None,
        login_required=False, context_processors=None, form_class=None):
    
    if extra_context is None:
        extra_context = {}
    if login_required and not request.user.is_authenticated:
        return redirect_to_login(request.path)

    model, form_class = get_model_and_form_class(model, form_class)
    if request.method == 'POST':
        form = form_class(request.POST, request.FILES)
        if form.is_valid():
            new_object = form.save()

            msg = ugettext("The %(verbose_name)s was created successfully.") %\
                {"verbose_name": model._meta.verbose_name}
            messages.success(request, msg, fail_silently=True)
            return redirect(post_save_redirect, new_object)
    else:
        form = form_class()

    # Create the template, context, response
    if not template_name:
        template_name = "%s/%s_form.html" % (
            model._meta.app_label, model._meta.object_name.lower())
    t = template_loader.get_template(template_name)
    c = {
        'form': form,
    }
    apply_extra_context(extra_context, c)
    return HttpResponse(t.render(context=c, request=request))
520902
def new(self, request):
        """"""
        form = (self.form or generate_form(self.model))()

        return self._render(
            request = request,
            template = 'new',
            context = {
                'form': form
            },
            status = 200
        )
123426
def create(input_width, input_height, input_channels=1, output_dim=512, initial_std_dev=0.4, factorized_noise=True):
    
    def instantiate(**_):
        return DoubleNoisyNatureCnn(
            input_width=input_width, input_height=input_height, input_channels=input_channels,
            output_dim=output_dim, initial_std_dev=initial_std_dev, factorized_noise=factorized_noise
        )

    return ModelFactory.generic(instantiate)
1107476
def create(cls, train_ds, valid_ds, test_ds=None, path:PathOrStr='.', no_check:bool=False, bs=64, val_bs:int=None,
               num_workers:int=0, device:torch.device=None, collate_fn:Callable=data_collate,
               dl_tfms:Optional[Collection[Callable]]=None, bptt:int=70, backwards:bool=False, **dl_kwargs) -> DataBunch:
        ""
        datasets = cls._init_ds(train_ds, valid_ds, test_ds)
        val_bs = ifnone(val_bs, bs)
        datasets = [LanguageModelPreLoader(ds, shuffle=(i==0), bs=(bs if i==0 else val_bs), bptt=bptt, backwards=backwards)
                    for i,ds in enumerate(datasets)]
        val_bs = bs
        dls = [DataLoader(d, b, shuffle=False, **dl_kwargs) for d,b in zip(datasets, (bs,val_bs,val_bs,val_bs)) if d is not None]
        return cls(*dls, path=path, device=device, dl_tfms=dl_tfms, collate_fn=collate_fn, no_check=no_check)
1002356
def _create(cls, model_class, *args, **kwargs):
        """"""
        session = cls._meta.sqlalchemy_session
        session_persistence = cls._meta.sqlalchemy_session_persistence
        if cls._meta.force_flush:
            session_persistence = SESSION_PERSISTENCE_FLUSH

        obj = model_class(*args, **kwargs)
        if session is None:
            raise RuntimeError("No session provided.")
        session.add(obj)
        if session_persistence == SESSION_PERSISTENCE_FLUSH:
            session.flush()
        elif session_persistence == SESSION_PERSISTENCE_COMMIT:
            session.commit()
        return obj