Create a new figure manager instance for the given figure.
192466
def new_figure_manager_given_figure(num, figure):
    
    fig = figure
    frame = FigureFrameWx(num, fig)
    figmgr = frame.get_figure_manager()
    if matplotlib.is_interactive():
        figmgr.frame.Show()

    return figmgr
1260187
def create(fc_layers=None, dropout=None, pretrained=True):
    
    def instantiate(**_):
        return Resnet34(fc_layers, dropout, pretrained)

    return ModelFactory.generic(instantiate)
475658
def create(self):
        
        self.add_handlers({'^T': self.quit, '^Q': self.quit})
        self.add(npyscreen.Textfield,
                 value='Add a plugin from a Git repository or an image from a '
                       'Docker registry.',
                 editable=False,
                 color='STANDOUT')
        self.add(npyscreen.Textfield,
                 value='For Git repositories, you can optionally specify a '
                       'username and password',
                 editable=False,
                 color='STANDOUT')
        self.add(npyscreen.Textfield,
                 value='for private repositories.',
                 editable=False,
                 color='STANDOUT')
        self.add(npyscreen.Textfield,
                 value='For Docker images, specify a name for referencing the '
                       'image that is being',
                 editable=False,
                 color='STANDOUT')
        self.add(npyscreen.Textfield,
                 value='added and optionally override the tag and/or the '
                       'registry and specify',
                 editable=False,
                 color='STANDOUT')
        self.add(npyscreen.Textfield,
                 value='comma-separated groups this image should belong to.',
                 editable=False,
                 color='STANDOUT')
        self.nextrely += 1
        self.repo = self.add(npyscreen.TitleText,
                             name='Repository',
                             value=self.default_repo)
        self.user = self.add(npyscreen.TitleText, name='Username')
        self.pw = self.add(npyscreen.TitlePassword, name='Password')
        self.nextrely += 1
        self.add(npyscreen.TitleText,
                 name='OR',
                 editable=False,
                 labelColor='STANDOUT')
        self.nextrely += 1
        self.image = self.add(npyscreen.TitleText, name='Image')
        self.link_name = self.add(npyscreen.TitleText,
                                  name='Name')
        self.tag = self.add(npyscreen.TitleText, name='Tag', value='latest')
        self.registry = self.add(npyscreen.TitleText,
                                 name='Registry',
                                 value='docker.io')
        self.groups = self.add(npyscreen.TitleText, name='Groups')
        self.repo.when_value_edited()
988657
def _set_up_figure(self, x_mins, x_maxs, y_mins, y_maxs):
        
        self.fig = plt.figure()

        # Make room for the sliders:
        bot = 0.1 + 0.05*len(self.model.params)
        self.fig.subplots_adjust(bottom=bot)

        # If these are not ints, matplotlib will crash and burn with an utterly
        # vague error.
        nrows = int(np.ceil(len(self._projections)**0.5))
        ncols = int(np.ceil(len(self._projections)/nrows))

        # Make all the subplots: set the x and y limits, scatter the data, and
        # plot the putative function.
        self._plots = {}

        for plotnr, proj in enumerate(self._projections, 1):
            x, y = proj
            if Derivative(y, x) in self.model:
                title_format = '$\\frac{{\\partial {dependant}}}{{\\partial {independant}}} = {expression}$'
            else:
                title_format = '${dependant}({independant}) = {expression}$'
            plotlabel = title_format.format(
                dependant=latex(y, mode='plain'),
                independant=latex(x, mode='plain'),
                expression=latex(self.model[y], mode='plain'))
            ax = self.fig.add_subplot(ncols, nrows, plotnr,
                                      label=plotlabel)
            ax.set_title(ax.get_label())
            ax.set_ylim(y_mins[y], y_maxs[y])
            ax.set_xlim(x_mins[x], x_maxs[x])
            ax.set_xlabel('${}$'.format(x))
            ax.set_ylabel('${}$'.format(y))
            self._plot_data(proj, ax)
            plot = self._plot_model(proj, ax)
            self._plots[proj] = plot
1284217
def create_model(cls, data: dict, fields=None):
        '''
        
        '''
        if fields is None:
            fields = set(cls._fields.keys())
        else:
            if not isinstance(fields, set):
                fields = set(fields)
        new_keys = set(data.keys()) - fields
        if new_keys:
            for new_key in new_keys:
                del data[new_key]
        return cls(data)
366659
def create(cls, h:int, w:int, bboxes:Collection[Collection[int]], labels:Collection=None, classes:dict=None,
               pad_idx:int=0, scale:bool=True)->'ImageBBox':
        ""
        if isinstance(bboxes, np.ndarray) and bboxes.dtype == np.object: bboxes = np.array([bb for bb in bboxes])
        bboxes = tensor(bboxes).float()
        tr_corners = torch.cat([bboxes[:,0][:,None], bboxes[:,3][:,None]], 1)
        bl_corners = bboxes[:,1:3].flip(1)
        bboxes = torch.cat([bboxes[:,:2], tr_corners, bl_corners, bboxes[:,2:]], 1)
        flow = FlowField((h,w), bboxes.view(-1,2))
        return cls(flow, labels=labels, classes=classes, pad_idx=pad_idx, y_first=True, scale=scale)
807630
def create(self, name, *args, **kwargs):
        
        cont = kwargs.get("cont")
        if cont:
            # Verify that it exists. If it doesn't, a NoSuchContainer exception
            # will be raised.
            api = self.api
            rgn = api.region_name
            cf = api.identity.object_store[rgn].client
            cf.get_container(cont)
        return super(ImageTasksManager, self).create(name, *args, **kwargs)
762160
def _imm_new(cls):
    '''
    
    '''
    imm = object.__new__(cls)
    # Note that right now imm has a normal setattr method;
    # Give any parameter that has one a default value
    params = cls._pimms_immutable_data_['params']
    for (p,dat) in six.iteritems(params):
        dat = dat[0]
        if dat: object.__setattr__(imm, p, dat[0])
    # Clear any values; they are not allowed yet
    _imm_clear(imm)
    # Note that we are initializing...
    dd = object.__getattribute__(imm, '__dict__')
    dd['_pimms_immutable_is_init'] = True
    # That should do it!
    return imm
1039422
def setup_figure():
    """"""
    fig, axes = mplstereonet.subplots(ncols=2, figsize=(20,10))
    for ax in axes:
        # Make the grid lines solid.
        ax.grid(ls='-')
        # Make the longitude grids continue all the way to the poles
        ax.set_longitude_grid_ends(90)
    return fig, axes
732854
def create(self, **kwargs):
        
        model = self.new(**kwargs)
        return self.save(model)
846993
def add_manager(model):
    
    if model._meta.abstract:
        return
    # Make all managers local for this model to fix patching parent model managers
    model._meta.local_managers = model._meta.managers

    for current_manager in model._meta.local_managers:
        prev_class = current_manager.__class__
        patch_manager_class(current_manager)
        if model._default_manager.__class__ is prev_class:
            # Normally model._default_manager is a reference to one of model's managers
            # (and would be patched by the way).
            # However, in some rare situations (mostly proxy models)
            # model._default_manager is not the same instance as one of managers, but it
            # share the same class.
            model._default_manager.__class__ = current_manager.__class__
    patch_manager_class(model._base_manager)
    model._meta.base_manager_name = 'objects'
    model._meta._expire_cache()
82854
def create(self, name, *args, **kwargs):
        
        resource_name = self._resource_name(name)
        log.info(
            "Creating {} '{}'...".format(self._model_name, resource_name))
        resource = self.collection.create(*args, name=resource_name, **kwargs)
        self._ids.add(resource.id)
        return resource
996012
public <T> T createModel(Class<T> clazz) throws CreateModelException {
        return createModel(clazz, true);
    }
376021
public void addFigure(Figure figure) {
		figures.add(figure);
		figureMap.put(figure.getData().getAttribute(NonGeometricData.ID), figure);
		
		String fillRef = figure.getData().getAsReference(NonGeometricData.FILL);
		Gradient gradient = getGradient(fillRef);
		if (gradient != null) {
			if (gradient.isRadial()) {
				for (int i=0;i<InkscapeLoader.RADIAL_TRIANGULATION_LEVEL;i++) {
					figure.getShape().increaseTriangulation();
				}
			}
		}
	}
81270
def create_for_data(cls, data, format, width, height, stride=None):
        
        return cls(format, width, height, data, stride)
246445
public static Diagram diagram( String name, Figure figure )
    {
        return new Diagram( requireNonNull( name, "name" ), FigureBuilder.root( requireNonNull( figure, "figure" ) ) );
    }
993485
def set_figure(self, figure, handle=None):
        """"""
        self.figure = figure
        self.bkimage = None
        self._push_handle = handle

        wd = figure.plot_width
        ht = figure.plot_height

        self.configure_window(wd, ht)

        doc = curdoc()
        #self.logger.info(str(dir(doc)))
        doc.add_periodic_callback(self.timer_cb, 50)
        self.logger.info("figure set")