If only the singleton instance exists, pass ``True`` for
        ``singleton`` into the template which will use CSS to hide
        the "save and add another" button.
346609
def change_view(self, *args, **kwargs):
        
        kwargs.setdefault("extra_context", {})
        kwargs["extra_context"]["singleton"] = self.model.objects.count() == 1
        response = super(SingletonAdmin, self).change_view(*args, **kwargs)
        return self.handle_save(args[0], response)
1045909
function create_if_block(component, ctx) {
	var button;

	function click_handler(event) {
		component.set({ scrimVisible: true });
	}

	return {
		c() {
			button = createElement("button");
			button.textContent = "Preview Scrim";
			addListener(button, "click", click_handler);
		},

		m(target, anchor) {
			insert(target, button, anchor);
		},

		p: noop,

		d(detach) {
			if (detach) {
				detachNode(button);
			}

			removeListener(button, "click", click_handler);
		}
	};
}
554855
function State(template, easyButton){

  this.title = template.title;
  this.stateName = template.stateName ? template.stateName : 'unnamed-state';

  // build the wrapper
  this.icon = L.DomUtil.create('span', '');

  L.DomUtil.addClass(this.icon, 'button-state state-' + this.stateName.replace(/(^\s*|\s*$)/g,''));
  this.icon.innerHTML = buildIcon(template.icon);
  this.onClick = L.Util.bind(template.onClick?template.onClick:function(){}, easyButton);
}
160113
function (buttonState) {
            var scenarios = document.querySelectorAll('.scenario'),
                hasClass,
                self = this;
            for (var i = 0; i < scenarios.length; i++) {
                hasClass = scenarios[i].classList.contains(buttonState);
                if (hasClass === true) {
                    if (scenarios[i].parentNode.style.display === 'none') {
                        scenarios[i].parentNode.style.display = 'block';
                    }
                } else {
                    scenarios[i].parentNode.style.display = 'none';
                }
            }

            if (buttonState === 'failed') {
                self.currentView = 'failed';
                this.hideFeatureContainer('passed');
            } else {
                self.currentView = 'passed';
                this.hideFeatureContainer('failed');
            }
        }
601302
def copy(self, inheritance=False):
        # type: (bool) -> FactoryContext
        
        # Create a new factory context and duplicate its values
        new_context = FactoryContext()
        for field in self.__slots__:
            if not field.startswith("_"):
                setattr(
                    new_context, field, self._deepcopy(getattr(self, field))
                )

        if inheritance:
            # Store configuration as inherited one
            new_context.__inherited_configuration = self.__handlers.copy()
            new_context.__handlers = {}

        # Remove instances in any case
        new_context.__instances.clear()
        new_context.is_singleton_active = False
        return new_context
1282646
def c_raw_singleton src, options = {}
      options = {
        :singleton => true,
      }.merge options
      self.generate src, options
    end
300448
function () {
        var self = this, id = self._id, prefix = self.classPrefix, text = self.state.get('text');
        var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
        var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : '',
          textHtml = '';

        if (text) {
          self.classes.add('btn-has-text');
          textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
        }

        return (
          '<div id="' + id + '" class="' + self.classes + '" role="button" tabindex="-1" aria-haspopup="true">' +
          '<button role="presentation" hidefocus="1" type="button" tabindex="-1">' +
          (icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
          '<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' +
          textHtml +
          '</button>' +
          '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
          ' <i class="' + prefix + 'caret"></i>' +
          '</button>' +
          '</div>'
        );
      }
230304
function make_singleton( Constructor, singleton_config ) {
		process_after( Constructor );

		var instance = Constructor.create.apply( null, singleton_config === true ? [] : [].concat( singleton_config ) );

		util.def( Constructor, __singleton__, util.describe( { value : instance }, 'r' ) );

		return instance;
	}
525281
function(oInstance) {

			// ensure that the instance count is never negative
			var iInstanceCount = Math.max(this._iInstanceCount - 1, 0);

			// deactivate the instance customizing
			if (oInstance) {
				this.deactivateCustomizing(oInstance);
			}

			if (iInstanceCount === 0) {

				// deactivcate the customizing
				this.deactivateCustomizing();

				// remove the custom scripts and CSS files
				this.removeIncludes();

			}

			this._iInstanceCount = iInstanceCount;

		}
76090
function (onlyCSSDep) {
            var classes = this._cssClasses;
            if (!classes) {
                if (this._cfg.isRootTemplate) {
                    // PTR 05086835: load the global CSS here, and remember that it was loaded
                    var deps = ['aria.templates.GlobalStyle'];
                    if (aria.widgets && aria.widgets.AriaSkin) {
                        deps.push('aria.templates.LegacyGeneralStyle');
                    }
                    ariaTemplatesCSSMgr.loadWidgetDependencies('aria.templates.Template', deps);
                    this._globalCssDepsLoaded = true;
                }
                // Load the CSS dependencies, the style should be added before the html
                classes = ariaTemplatesCSSMgr.loadDependencies(this);
                this._cssClasses = classes; // save classes for later calls
            }
            if (onlyCSSDep) {
                return classes.join(" ");
            }
            var classNames = ["xTplContent"];
            // Add also the classes used by the CSS manager to scope a dependency
            if (classes.length) {
                classNames = classNames.concat(classes);
            }
            return ariaCoreTplClassLoader.addPrintOptions(classNames.join(" "), this._cfg.printOptions);
        }
1156461
def getInstance(cls, *args):
        '''
        
        '''
        if not cls.__singleton:
            cls.__singleton = Heroku(*args)
        return cls.__singleton
1351141
def singleton(func):
    

    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        if wrapper.__call_state__ == CALLED:
            return
        ret = func(*args, **kwargs)
        wrapper.__call_state__ = CALLED
        return ret

    def reset():
        wrapper.__call_state__ = NOT_CALLED

    wrapper.reset = reset
    reset()

    # save original func to be able to patch and restore multiple times from
    # unit tests
    wrapper.__original_func = func
    return wrapper
1085391
def preferences_class_prepared(sender, *args, **kwargs):
    
    cls = sender
    if issubclass(cls, Preferences):
        # Add singleton manager to subclasses.
        cls.add_to_class('singleton', SingletonManager())
        # Add property for preferences object to preferences.preferences.
        setattr(preferences.Preferences, cls._meta.object_name, property(lambda x: cls.singleton.get()))
285869
def get_instance_for_appending(rails_mode, target_path)
      template = get_erb_template(@custom_template, false, rails_mode, target_path)
      ERB.new(template, nil, '-', '_additional_spec_code')
    end
149299
def create!(view_or_constant, style=nil, opts = {}, &block)
      opts[:raw_block] = block if block
      create(view_or_constant, style, opts).get
    end
904911
function (options) {
            var key;
            for (key in this.config) {
                if (this.config.hasOwnProperty(key) && this.config[key].singleton) {
                    this._init(key, options);
                }
            }
            return this;
        }
628995
def singleton_per_scope(_cls, _scope=None, _renew=False, *args, **kwargs):
    """"""

    result = None

    singletons = SINGLETONS_PER_SCOPES.setdefault(_scope, {})

    if _renew or _cls not in singletons:
        singletons[_cls] = _cls(*args, **kwargs)

    result = singletons[_cls]

    return result